[whatwg] Navigation events generated during unload
ian at hixie.ch
Tue Oct 13 15:22:53 PDT 2009
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
> 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:
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. `._.-(,_..'--(,_..'`-.;.'
More information about the whatwg