The global object in browsers

Ian Hickson ian at hixie.ch
Tue Feb 17 14:51:06 PST 2009


On Tue, 17 Feb 2009, Mark S. Miller wrote:
> 
> I don't understand. If the object you're calling Window is inaccessible 
> from ES code, and if the object you're calling WindowProxy forwards 
> everything to your Window, why not just relabel Window -> 
> InternalWindow, WindowProxy -> Window?

I don't really mind what the objects are called, the point is just that 
the object at the top of the scope chain is not the same as the object 
returned by "this" (or "window" on the global object).


> And in any case, why not just provide your WindowProxy as the global 
> object to ES code? Why does ES need to be aware of your Window at all?

When a browsing context navigates from page A to page B, the object at the 
top of the scope chain in code from page A and the oject at the top of the 
scope chain in code from page B are not the same object, but the object 
returned by the global-scope "this" in scripts from A and B are the same 
object (===).


> The deeper problem here is that ES specs to date -- including the draft 
> ES3.1 spec -- have not yet admitted the existence of multiple global 
> objects. We all know we need to, but it is *way* too late to consider 
> such a change for ES3.1.

Ok. This unfortunately leaves us in the status quo position where HTML5 
has to require something that violates the ES specs.

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'


More information about the Es-discuss mailing list