Re: scopes, execution contexts, and scripts
"John J. Barton" <[email protected]> Tue, 26 Jan 2010 11:04:44 -0800
| Newsgroups | gmane.comp.mozilla.devel.jsdebugger |
|---|---|
| Message-ID | <[email protected]> |
Boris Zbarsky wrote: > 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). and how to distinguish the (and possibly..) case from unload-because-we-are-being-deleted. > >> // 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. And so to handle this case, I guess I need to track onLocationChange events for every nsIDOMWindow? I don't understand how to tell if a window is being destroyed after unload vs being reused. > > -Boris