User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:126.96.36.199) Gecko/20090729 Firefox/3.5.2 Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:188.8.131.52) Gecko/20090729 Firefox/3.5.2 Given a script that executes w=window.open(...) and then w.close(), the onbeforeunload event in the referenced window fires twice. Reproducible: Always Steps to Reproduce: 1. Open the attached test case in window/tab 1. 2. Click "open" - this will open window/tab 2 and load the same document. 3. Switch back to window/tab 1. 4. Click "close" and note the alerts produced. Actual Results: In step 4 the alerts I see are "beforeUnload with 1", then "beforeUnload with 2", then "unload with 1". These show that the beforeunload event has fired twice whilst the unload event has fired once. Expected Results: Unless there's a reason why beforeunload should fire twice the alerts should be "beforeUnload with 1" followed by "unload with 1". If instead of steps 3 and 4 you simply close tab 2 then both events fire once as expected.
This is a regression in Firefox 3.5 (OK in 3.0.13).
(In reply to comment #2) > This is a regression in Firefox 3.5 (OK in 3.0.13). No it isn't, just that I can't follow my own instructions. Same behaviour on Fx 3.0.13 and 184.108.40.206
See also bug 531199.
This is bug 305085.
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → DUPLICATE
I can't reproduce this using Fx 7.0.1. Not 100% sure it is a duplicate of the other bug but it is definitely WFM.
Not a duplicated of 305085 as that bug is still an issue (just tried it) whilst this one is resolved.
Resolution: DUPLICATE → WORKSFORME
(In reply to Duncan Loveday from comment #7) > Not a duplicated of 305085 as that bug is still an issue (just tried it) > whilst this one is resolved. How do the two bugs differ? They both describe windows with onbeforeunload closed via window.close(); what makes the procedures different?
Josh, you may well be right. I was wrong earlier when I said this was working, was clicking the "Close Tab" icon on the tab header instead of the "Close" button in the document. And the bugs are indeed very similar, the only difference is that mine has the window.close() being invoked from the opener but that may not be significant. I've set the status back to how you had it, sorry for the misunderstanding.
Resolution: WORKSFORME → DUPLICATE
Component: Event Handling → User events and focus handling
You need to log in before you can comment on or make changes to this bug.