Modal dialog: alert() dialog gets aborted with exception "prompt aborted by user" after double click

UNCONFIRMED
Unassigned

Status

()

Toolkit
Notifications and Alerts
UNCONFIRMED
7 years ago
4 years ago

People

(Reporter: restaurant, Unassigned)

Tracking

6 Branch
x86
Windows XP
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

7 years ago
User Agent: Mozilla/5.0 (Windows NT 5.1; rv:6.0.1) Gecko/20100101 Firefox/6.0.1
Build ID: 20110830092941

Steps to reproduce:

This is a simplified version of a script that is used on a website:

<form onsubmit="return check();" action="..." method="post">
<script type="text/javascript">
var i = 0;
function check() {
   if (i++ == 0) {
     return true;
   } else {
     window.alert('Your request has been sent!');}
     return false
   }
}
</script>

...

</form>

The script is ment to only submit once, no matter how often you try to submit (by mouse click or button press). It's not necessary to discuss the usefulness of the script :-)

I know, nowadays this script is unnessecary. But let's imagine there are more things done in the script than shown above.


Actual results:

If you double click on the submit button, the request gets submitted twice and the alert()-dialog appears only for a fraction of a second. Most likely, this only works, when there is a certain delay until the request is answered by the server, so that the next page won't open instantaneously. 0.5sec should be enough.

The error console shows: 
uncaught exception: [Exception... "prompt aborted by user" nsresult: "0x80040111 (NS_ERROR_NOT_AVAILABLE)" location: "JS frame :: resource:///components/nsPrompter.js :: openTabPrompt :: line 462" data: no]


Expected results:

1. The form should be submitted only once
2. The modal dialog should open and block any user input until the user clicks "OK" or until the next page has come up.
probably a related to bug 663515
Component: General → General
Product: Firefox → Toolkit
QA Contact: general → general
Bulk move to Toolkit::Notifications and Alerts

Filter on notifications-and-alerts-component.
Component: General → Notifications and Alerts

Comment 3

4 years ago
This bug mainly effects developers trying to debug, disallowing them from seeing the alert before a page refresh, back button press, or form submit, etc. It can be circumvented by setting prompts.tab_modal.enabled = false in about:config. This will at least allow one to view the alert, but won't stop the refresh.
You need to log in before you can comment on or make changes to this bug.