W3C home > Mailing lists > Public > whatwg@whatwg.org > October 2009

[whatwg] Navigation events generated during unload

From: Ian Hickson <ian@hixie.ch>
Date: Tue, 13 Oct 2009 22:22:53 +0000 (UTC)
Message-ID: <Pine.LNX.4.62.0910132218190.6803@hixie.dreamhostps.com>
On Tue, 13 Oct 2009, Boris Zbarsky wrote:
> On 10/13/09 7:00 AM, Ian Hickson wrote:
> > > >      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:
> > 
> >     http://www.hixie.ch/tests/adhoc/html/navigation/unload/cross-origin/004.html
> 
> In the "cross-origin" test, the load that's happening is that of 
> "http://another.domain.libpr0n.com/pass" while the form action is 
> "http://www.hixie.ch/tests/adhoc/html/navigation/unload/cross-origin/pass" 
> as far as I can tell.  Those are not same-origin, right?

Cross-origin 004 opens two files, 004a and 004b.

004a has a link to: http://another.domain.libpr0n.com/pass

When you click that link, the first frame begins navigating to that URL. 
Before it does so, it performs a cross-frame form submission to:
   http://www.hixie.ch/tests/adhoc/html/navigation/unload/cross-origin/pass

Since that's the same origin as the target frame, it should work per spec, 
but it doesn't in Firefox.

(If it did work, then 004b, which is replaced by that form submission, 
would try to do a cross-frame form submission again, but by this time 004a 
is gone and so it would be a cross-origin frame targetting, which is 
disallowed, and thus nothing happens, regardless of the URL being navigated.)


> > 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.
> 
> Aha.  Perfect, thanks.  The text in the spec had just made it sound like 
> the async phase happened _after_ one started parsing the new document. 
> Good to know that's not the case.

Technically you are allowed to, but you have to switch before you run any 
scripts, so it's basically just allowing a minor optimisation.

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'
Received on Tuesday, 13 October 2009 15:22:53 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:59:18 UTC