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

Re: "var" declarations shadowing properties from Window.prototype

From: Brendan Eich <brendan@mozilla.com>
Date: Sun, 12 Aug 2012 10:59:26 -0700
Message-ID: <5027EEFE.2030606@mozilla.com>
To: Boris Zbarsky <bzbarsky@MIT.EDU>
CC: Cameron McCormack <cam@mcc.id.au>, public-script-coord@w3.org, es-discuss@mozilla.org
Boris Zbarsky wrote:
> On 8/11/12 10:42 PM, Brendan Eich wrote:
>> However, implementations (at least Gecko) give window a proto chain that
>> is "interesting":
>
> Indeed.  For one thing, we haven't switched Window to the new bindings 
> yet.

Could you lay out the new chain here, e.g. 
viaObject.prototype.toString.call(window.__proto__).slice(8,-1) or better?

I'm hoping my Web Console inspection was accurate for DOM content 
windows in the current (old) bindings.

>> This is from a stable-release Firefox Web Console. I believe it matches
>> a real DOM content window. I don't see EventTarget
>
> Because it's not on the proto chain at all; in Gecko as of today 
> Window doesn't inherit from EventTarget; instead "Window implements 
> EventTarget", effectively.  Again, we just haven't switched Window to 
> WebIDL yet.

Sure. Still, either way (old or new bindings), the EventTarget 
attributes and operations go on a prototype (old: Window.prototype, new: 
EventTarget.prototype, please correct me if I'm wrong). Which makes for 
the var+obj-detection hazard.

> The Global Scope Polluter you see there, though, is in fact defined in 
> WebIDL.

Cool, I guess. Standardized pollution, what a world!

>> But the exact chain is not something that should be
>> standardized in detail.
>
> Why not?

Good question. If browser vendors can agree on total window proto-chain 
spec for maximum interop, ok. I had thought there were unobservable 
(prior to ES5) differences among impls that vendors might not want to 
change. ES5 reflection may disclose these but not create real interop 
issues.

/be
Received on Sunday, 12 August 2012 17:59:55 UTC

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