[whatwg] Navigation events generated during unload

Ian Hickson ian at hixie.ch
Tue Oct 13 04:00:13 PDT 2009

On Mon, 12 Oct 2009, Boris Zbarsky wrote:
> On 10/12/09 1:55 AM, Ian Hickson wrote:
> > Why is the form.submit() ignored? It's not ignored in, e.g.:
> > 
> >     http://www.hixie.ch/tests/adhoc/html/navigation/unload/same-origin/004.html
> But in this case the form action is same-origin with the load that's
> happening....

As it is on the other one:


> > > Also, I'm not quite sure what the part about unloading that comes 
> > > after the algorithm you pointed me to means.  Does it mean that once 
> > > you get the response and start parsing the new document you queue a 
> > > task to unload the old one?  That doesn't seem at all right to me, 
> > > since at this point the new document can be running scripts that 
> > > touch the WindowProxy they share...
> > 
> > Not sure what you mean here. I've tried to clarify that the new page 
> > must be active before any scripts run.
> Looking at the algorithm steps when I made my last comment, it sounded 
> like the new data starts coming in, the UA starts processing it, and 
> queues a task to unload the old document.  Gecko at the moment, for 
> example, unloads the old document immediately after firing unload on it, 
> and before parsing any of the new document.  Is that the behavior the 
> spec calls for?

The navigation algorithm goes through an asynchronous phase (waiting on 
the network, doing some sniffing in the background), but once it goes back 
to the synchronous stage where unload is fired, everything else happens in 
one go; there's no spinning of the event loop between the old page 
getting unload, the page being unloaded, and the new page being put into 
the session history and brought up.

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

More information about the whatwg mailing list