- From: Travis Leithead <travis.leithead@microsoft.com>
- Date: Wed, 4 Jan 2012 20:00:31 +0000
- To: Boris Zbarsky <bzbarsky@MIT.EDU>
- CC: Ojan Vafai <ojan@chromium.org>, Cameron McCormack <cam@mcc.id.au>, "public-script-coord@w3.org" <public-script-coord@w3.org>, Allen Wirfs-Brock <allen@wirfs-brock.com>, Ian Hickson <ian@hixie.ch>
>-----Original Message----- >From: Boris Zbarsky [mailto:bzbarsky@MIT.EDU] > >On 1/4/12 2:28 PM, Travis Leithead wrote: >> I'm going to reason about an implementation detail without verifying it >>here... my guess is that the var declaration code (without assignment) is >>failing to perform a full lookup of the window object before assigning the >>var. > >What |var| should do is look for an own property on the global and >create one if there isn't one. > >> So, in IE, Firefox, and Opera, the prototype chain (and by inference the >>GSP) is not even getting consulted given the proposed lookup order and this >>scenario. > >Agreed on proto chain. Per spec, var should not look at the proto chain >before defining the property on the global. In that case, Chrome/Safari are clearly wrong according to my test. But that's beside the point. >My question is precisely about the "by inference the GSP" part. In >_Gecko_, the GSP is an object on the proto chain of the window; those >properties to not live on the window object itself. Per current WebIDL >spec, the GSP properties just live on the window object itself. What >does IE do with GSP properties? What about Opera? > >>> Or does IE put all its GSPs, including frame names, on the proto chain >>> and not on the object itself? > >This is the question I'd really like an answer to. Let me make sure that I understand you use of "GSP". There are pre-defined properties (as described in the "interface Window" per HTML5). Those are included in the window's prototype chain (not on the window instance/global itself. Then there are "dynamic" properties which in IE include frame names, frame indexes, and elements with id, etc. I assume by GSP that you refer to the latter. IE's GSP is tied to the proxy object around the window instance/global object -- it's not in the prototype chain. Think of IE's GSP as a look-aside object of the window instance. A property is searched for by the window instance, then depending on usage, the GSP is consulted. For var declarations on the global object/window instance that _are not_ assignments, the check for an existing GSP property name is not made. We could go either way, but also prefer to allow the var declarations to shadow. > >-Boris >
Received on Wednesday, 4 January 2012 20:18:43 UTC