W3C home > Mailing lists > Public > public-script-coord@w3.org > July to September 2014

Re: Exposing constructors of readonly interfaces to web authors

From: Robert O'Callahan <robert@ocallahan.org>
Date: Wed, 2 Jul 2014 10:57:18 +1200
Message-ID: <CAOp6jLY3dUYB_oUFR23hFcqML5dYwBSAB4_c9e9LqMMazVpETA@mail.gmail.com>
To: Domenic Denicola <domenic@domenicdenicola.com>
Cc: Rik Cabanier <cabanier@gmail.com>, Dirk Schulze <dschulze@adobe.com>, Ian Hickson <ian@hixie.ch>, "public-script-coord@w3.org" <public-script-coord@w3.org>
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

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 17:14:22 UTC