Re: Exposing constructors of readonly interfaces to web authors

On Wed, Jul 2, 2014 at 10:16 AM, Domenic Denicola <
domenic@domenicdenicola.com> wrote:

> 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.


I see where you're coming from, but I think the underlying problem is that
JS lets you do such prototype and method equality checks in the first
place, thus exposing implementation decisions that should not be exposed. I
do not want to force such exposure onto DOM APIs.

Rob
-- 
Jtehsauts  tshaei dS,o n" Wohfy  Mdaon  yhoaus  eanuttehrotraiitny  eovni
le atrhtohu gthot sf oirng iyvoeu rs ihnesa.r"t sS?o  Whhei csha iids  teoa
stiheer :p atroa lsyazye,d  'mYaonu,r  "sGients  uapr,e  tfaokreg iyvoeunr,
'm aotr  atnod  sgaoy ,h o'mGee.t"  uTph eann dt hwea lmka'n?  gBoutt  uIp
waanndt  wyeonut  thoo mken.o w

Received on Tuesday, 1 July 2014 22:57:46 UTC