J
Jorge
(...)
Even if `window` and Global Object are not the same object (which is
likely, given security boundaries described in MDC article), the chances
of any browser breaking `window == Global Object` (or making their
distinction noticeable) seem to be extremely low.
The way I understand it the problem is that the ES specs expect a
single global object but in a browser there may easily be more than
one, for example when there's an iframe.
That MDC article says "The window object for tab TB must persist as
the user navigates from page to page in that tab".
Swapping global objects behind a single window reference ? But how
does that work, exactly ?
For example, let's say that you've got an iframe, and you save in the
containing window's context a reference to a function f () { return
window; }; defined inside that iframe, then that iframe is navigated
away. Shouldn't the reference to f become undefined ? If not, what is
it, a reference to a function in an unreachable global object ? what
would f() return ? the new window's global, or the old one ? What
would f().f be ? undefined ? (assuming it's not re-defined in the new
page).