onbeforeunload event fires twice when a popup window is closed by its opener

RESOLVED DUPLICATE of bug 305085

Status

()

defect
RESOLVED DUPLICATE of bug 305085
10 years ago
3 months ago

People

(Reporter: duncan.loveday, Unassigned)

Tracking

({testcase})

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

Reporter

Description

10 years ago
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.1.2) Gecko/20090729 Firefox/3.5.2
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.1.2) 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.
Reporter

Comment 1

10 years ago
Posted file test case
Reporter

Updated

10 years ago
Keywords: testcase
Reporter

Comment 2

10 years ago
This is a regression in Firefox 3.5 (OK in 3.0.13).
Keywords: regression
Reporter

Comment 3

10 years ago
(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 2.0.0.20
Keywords: regression

Updated

9 years ago
Status: UNCONFIRMED → NEW
Ever confirmed: true

Updated

9 years ago
See Also: → 531199

Updated

9 years ago
See Also: → 369955

Comment 5

8 years ago
This is bug 305085.
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → DUPLICATE
Duplicate of bug: 305085
Reporter

Comment 6

8 years ago
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.
Reporter

Comment 7

8 years ago
Not a duplicated of 305085 as that bug is still an issue (just tried it) whilst this one is resolved.
Resolution: DUPLICATE → WORKSFORME

Comment 8

8 years ago
(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?
Reporter

Comment 9

8 years ago
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
Duplicate of bug: 305085
Component: Event Handling → User events and focus handling
You need to log in before you can comment on or make changes to this bug.