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

On 8/12/12 1:59 PM, Brendan Eich wrote:
> 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 believe the current spec calls something like this at the moment:

global -> Window.prototype -> Global Scope Polluter -> 
EventTarget.prototype -> Object.prototype

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

I think so, yes.

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

Yep.

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

Well, everyone except for Gecko implemented it (and even Gecko in quirks 
mode), and weren't willing to drop it, so...  I tried fighting it for a 
bit, but websites were starting to depend on it and not bother testing, 
so here we are.

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

Right, if we can't get implementations to agree we may need to revisit. 
  But so far there's agreement at least in principle (modulo the fact 
that some impls haven't really committed to implementing WebIDL at all, 
of course).

-Boris

Received on Sunday, 12 August 2012 20:28:32 UTC