W3C home > Mailing lists > Public > public-script-coord@w3.org > January to March 2012

Re: variable declarations shadowing named properties on window

From: Boris Zbarsky <bzbarsky@MIT.EDU>
Date: Wed, 04 Jan 2012 19:55:07 -0500
Message-ID: <4F04F4EB.8070009@mit.edu>
To: Travis Leithead <travis.leithead@microsoft.com>
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>
On 1/4/12 4:31 PM, Travis Leithead wrote:
> When you say "proxy" I assume you think that there are actually two objects, a "native object" and a "proxy object".

No, I'm just thinking there's something that can implement the various 
internal methods of ES directly, however it does that.

>> It really sounds like the behavior IE has here is not actually
>> describable in terms of the ES spec (even with proxies, if I understand
>> it correctly) as things stand...
>
> Not having a good understanding of ES proxies, I can't comment on that.

I believe the relevant parts of the spec go as follows.

For "var x", I believe the relevant section of ES 5 is 10.5.  Per step 
8, HasBinding is called.  HasBinding for the case when the environment 
is the global object is defined in section 10.2.1.2.1, and simple calls 
the [[HasProperty]] internal method.  If this returns true, then the var 
statement is supposed to be ignored per 10.5 step 8c.

So if we posit that IE is actually implementing this spec as written 
(which I sort of doubt; I don't think anyone is at the moment) 
presumably in IE [[HasProperty]] here returns false for properties that 
come from the GSP given the observed var behavior.

But then that would imply that other places that use [[HasProperty]] 
would need to return false too: the [[HasProperty]] call is not told 
that it's happening for a var binding.

In particular, I believe that would make the HasBinding concrete method 
return false for all GSP properties on the window, which means they 
couldn't be looked up as barewords.  But I could be misreading the spec, 
of course...

-Boris
Received on Thursday, 5 January 2012 00:55:38 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 8 May 2013 19:30:05 UTC