Closed Bug 1220109 Opened 9 years ago Closed 9 years ago

onbeforeunload does not fire on tab close

Categories

(Firefox :: Untriaged, defect)

45 Branch
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 967873

People

(Reporter: staffan.runnsjo, Unassigned)

Details

User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Firefox/45.0 Build ID: 20151029045227 Steps to reproduce: Load the html below, then close that tab without clicking in it This bug also affects refresh (F5), the first refresh does not trigger the event, the second one does. If you click anywhere in the viewport of the tab, refresh will start firing the event, but closing the tab will still not fire the event. <!DOCTYPE html> <html> <head> <title>Test</title> <script type="text/javascript"> window.onbeforeunload = function (e) { return 'Any string'; }; </script> </head> <body> <h1>Close this window without clicking in it</h1> </body> </html> Tested with Firefox Nightly 45.0a1 (2015-10-29) and Firefox Developer Edition 43.0a2 (2015-10-29) about:config dom.disable_beforeunload -> false dom.require_user_interaction_for_beforeunload -> false Actual results: no event fired Expected results: an onbeforeunload event should have been fired
Status: UNCONFIRMED → RESOLVED
Closed: 9 years ago
Resolution: --- → DUPLICATE
Staffan, have you really encountered this issue on e10s? (or maybe in non-e10s mode?)
Flags: needinfo?(staffan.runnsjo)
Yes, I just checked it again with the above html on Nightly 2015-11-10 in multi-process mode, and it is still the same behaviour.
Flags: needinfo?(staffan.runnsjo)
Hm, according to bug 636905, which is now fixed, Steps in comment 0 aren't supposed to work in both multi-process and 1-process modes. So, don't be surprised when you see the same on Release 44+
Correction: I was talking only about the case when you "close that tab without clicking in it". Anyway, 636905's summary is pretty clear.
You need to log in before you can comment on or make changes to this bug.