Open Bug 697948 Opened 13 years ago Updated 2 years ago

onbeforeunload dialog appears twice if POST warning dialog appears as well

Categories

(Core :: DOM: Events, defect, P5)

defect

Tracking

()

People

(Reporter: josh, Unassigned)

Details

If a page has an onbeforeunload event handler which returns a string to produce a dialog, *and* the previous page resulted from a POST which necessitates the POST warning dialog, then hitting the back button will cause he following to occur:
- The onbeforeunload dialog shows up.  Hit "Leave Page".
- The POST warning dialog shows up.  Hit "Resend" to proceed with re-POSTing.
- The onbeforeunload dialog shows up again.  Bug.


I discovered this bug when I went to edit a wiki page after logging in to that wiki via a POST.  Steps to reproduce via the GNOME wiki, which will probably work on just about any wiki:

- Have an account on https://live.gnome.org/ .  Anyone can register an account there.
- Start from a logged-out state, on any page you can edit.
- Click the login link (in the right sidebar).
- Log in; this submits the login form via a POST, and returns you to the page.
- Click the "Edit" button.
- Make any change to the page contents in the edit box; this enables the onbeforeunload handler.  (Don't save your changes.)
- Hit the back button.
Can Reproduce on the latest Nightly
Updated Steps to Reproduce:
1.Go to https://live.gnome.org/
2.Log-in
3.Click "Edit"
4.Type anything in the edit box
5.Click the Back button
6.Click "Leave Page"

Actual Results:
7.Another "Leave Page" dialog appears

Expected Results:
7.You are on the Gnome live Home page, without a second "Leave Page" dialog appearing

Chromium only displays one dialog
Version: 7 Branch → Trunk
I can also confirm that this occurs in the latest Nightly as of writing (Mozilla/5.0 (Windows NT 6.1; WOW64; rv:10.0a1) Gecko/20111028 Firefox/10.0a1) 

Also, on top of the double "Leave Page" dialogs, I get a "Document Expired" error as well.
https://bugzilla.mozilla.org/show_bug.cgi?id=1472046

Move all DOM bugs that haven’t been updated in more than 3 years and has no one currently assigned to P5.

If you have questions, please contact :mdaly.
Priority: -- → P5
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.