[whatwg] Navigation triggered from unload

James Graham jgraham at opera.com
Wed Jun 13 09:47:21 PDT 2012


On 06/12/2012 08:56 PM, Boris Zbarsky wrote:
> On 6/12/12 6:30 AM, James Graham wrote:
>> Based on some tests ([1]-[5]), it seems that WebKit seems to cancel the
>> navigation in the unload handler always, Opera seems to always carry out
>> the navigation in the unload handler, and Gecko seems to follow WebKit
>> in the cross-origin case and Opera in the same-origin case. In all cases
>> the unload handler is only called once.
>>
>> [1] http://hoppipolla.co.uk/tests/navigation/003.html
>> [2] http://hoppipolla.co.uk/tests/navigation/004.html
>> [3] http://hoppipolla.co.uk/tests/navigation/005.html
>> [4] http://hoppipolla.co.uk/tests/navigation/006.html
>> [5] http://hoppipolla.co.uk/tests/navigation/007.html
>
> For what it's worth, we initially tried to do what you say WebKit does
> but ran into web compat issues. See
> https://bugzilla.mozilla.org/show_bug.cgi?id=371360 for the original bug
> where we blocked all navigation during unload and
> https://bugzilla.mozilla.org/show_bug.cgi?id=409888 for the bug where we
> changed to the current behavior. I believe the spec says what it says
> based on our implementation experience here...

Hmm, so I wonder if the WebKit people consider it a problem that they 
don't pass the tests in those bug reports. I couldn't find any of the 
original sites still responding, so it's hard to know if there is still 
a compat. problem here. If there isn't, the greater conceptual 
simplicity of the WebKit model is quite appealing.

> P.S. Opera's behavior is not quite as simple as you describe: as far as
> I can tell it depends on whether the unload is happening due to the user
> typing something in the url bar or due to the user clicking a link, say.

That seems to be true. On the other hand it appears that gecko will 
still respect navigation from unload even if the unload was triggered by 
explicit user interaction (e.g. by editing the address bar), as long as 
all the origins match, so you can end up at a different page to the one 
you expected. That is very surprising behaviour (although I see that you 
can argue that it is possible in other ways).



More information about the whatwg mailing list