RE: Exposing constructors of readonly interfaces to web authors

From: rocallahan@gmail.com <rocallahan@gmail.com> on behalf of Robert O'Callahan <robert@ocallahan.org>

> Currently Gecko has an implementation of DOMQuadBounds with no corresponding WebIDL interface. If I understand you correctly, you say that because DOMQuadBounds has its own implementation, it must have its own WebIDL interface in the  spec.

I just checked with Nightly, and indeed the prototype is shared:

Object.getPrototypeOf((new DOMQuad()).bounds) === Object.getPrototypeOf(Object.getPrototypeOf(new DOMRect()))

This is baffling. Even more baffling when you consider that

Object.getOwnPropertyDescriptor(Object.getPrototypeOf((new DOMQuad()).bounds), "x").get === Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Object.getPrototypeOf(new DOMRect())), "x").get

So if I understand correctly, you are saying that there are two different functions being run when I do (new DOMQuad()).bounds.x and when I do (new DOMRect()).x, but to JavaScript, since DOMQuadBounds has a different implementation than DOMRect. But it looks like they are the same function to JavaScript?

How is this possible? It definitely doesn't seem desirable.

Received on Tuesday, 1 July 2014 22:17:00 UTC