Open
Bug 531199
Opened 15 years ago
Updated 2 years ago
beforeunload fires twice when closing popup with "Close" menu item
Categories
(Firefox :: General, defect)
Tracking
()
NEW
People
(Reporter: david.stark, Unassigned)
References
Details
Attachments
(2 files)
User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-GB; rv:1.9.1.5) Gecko/20091102 Firefox/3.5.5
Build Identifier: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-GB; rv:1.9.1.5) Gecko/20091102 Firefox/3.5.5
When the beforeunload handler is set on a popup window, using the "Close" menu item (or command-W) to close the window causes beforeunload to be fired once, and if the user chooses "OK" in the resulting "Are you sure you want to navigate away from this page?" dialog, beforeunload is fired a second time and the dialog comes up again.
If the popup window is closed by clicking on the close button, this problem does not occur.
Reproducible: Always
Steps to Reproduce:
Code the following:
1. In one file, using Javascript's window.open, create a popup window (a separate window, not a tab).
2. In the popup, set the window.beforeunload handler, eg:
window.onbeforeunload = function () { return "HAPPENS TWICE"; };
3. Load the first file.
4. Cause the popup to appear.
5. Close the popup *using the File->Close menu item*.
6. When the dialog saying "Are you sure you want to navigate away from this page?" comes up, choose "OK".
Actual Results:
The dialog is displayed a second time.
Expected Results:
The window should close immediately.
I will attach two files, loader.html and popup.html that demonstrate the problem.
Reporter | ||
Comment 1•15 years ago
|
||
Reporter | ||
Comment 2•15 years ago
|
||
Reporter | ||
Updated•15 years ago
|
Version: unspecified → 3.5 Branch
I am seeing the same symptoms on FF 3.5.5, and I feel it has only started happening recently.
For me, a popup is irrelevant. This happens on a single page with a beforeunload handler, when using Ctrl W to close the (single) tab.
Compare
http://code.google.com/p/chromium/issues/detail?id=11647
(In reply to comment #3)
> This may be a relative of bug 369955 .
also https://bugzilla.mozilla.org/show_bug.cgi?id=513566
Reporter | ||
Comment 6•13 years ago
|
||
I can confirm that this bug is still extant as of Firefox 11.0.
Version: 3.5 Branch → 11 Branch
Comment 7•12 years ago
|
||
Still exists in Firefox 16.0.1
Comment 8•11 years ago
|
||
Also exists in Firefox 26.0.
Test case:
1. Execute in JS-Konsole: window.open('https://bugzilla.mozilla.org/show_bug.cgi?id=531199', 'test');
2. Allow popup
3. Open JS-Konsole in the newly opened tab
4. Execute: window.onbeforeunload = function() { return "test"; };
5. Execute: window.close();
--> The dialog is shown twice.
Comment 9•4 years ago
|
||
I'm still experiencing this in Firefox 84. Will this eventually get fixed or is this no longer the right bug tracking software?
Updated•2 years ago
|
Severity: normal → S3
You need to log in
before you can comment on or make changes to this bug.
Description
•