Re: scopes, execution contexts, and scripts

Boris Zbarsky <[email protected]> Tue, 26 Jan 2010 13:13:50 -0500
Newsgroups gmane.comp.mozilla.devel.jsdebugger
Message-ID <[email protected]>
On 1/26/10 12:58 PM, John J. Barton wrote:
> In my unload handler for the outer DOM window I get called with window
> location = about:blank

OK, so about:blank is being unloaded (and possibly something else is 
being laoded instead).

> // domWindow.location is about blank here...
> setTimeout(function delayCleanup() // to allow the unload handlers to
> complete

So you run this code off a delay...

> // domWindow.location is chrome://test/content/testDialog.xul

Which presumably got loaded instead of the about:blank.

> So somehow about:blank is getting an unload message but the domWindow
> object I obtained from the unload handler event.target.defaultView; is
> morphing into the window that supports my dialog.

Again, a window can have the URI loaded in it change.  This happens all 
the time, in fact: if nothing else people browse the web.  When you 
navigate from page A to page B the Window object involved (the one you 
can get your hands on from script) does NOT change.  Its location.href 
does, of course.

-Boris