LeGEC LeGEC - 2 months ago 9x
jQuery Question

rules for "prevent this page from creating additional dialogs"

I try to understand Firefox's behavior regarding the added "prevent this page from creating additional dialogs" on dialog boxes.

Using jquery, if I add the following listeners :

<input class="testInput" />

.click(function(){ alert('clicked') })
.keyup(function(){ alert('keyup') })

  1. When clicking on the input, the alert box appears normally, until the
    ~13th time.

  2. When hitting a key, on the other hand, the second message box already
    appears with the message "prevent this page from creating additional
    dialogs". Actually, there seems to be some tiemout, and if I wait
    like 2 seconds between two keystrokes, the message disappears.

From my informal tests,
actually applies whenever the alert box is not called from within a onclick callback (e.g : keyup callback, displaying an alert box in answer to an ajax action...)

I am using Firefox 9.0.1 under Ubuntu, as far as I know I haven't tweaked firefox's settings regarding these thresholds.
I imagine it happens with any recent version of any browser.

I am using the jQuery library, but I don't think it is relevant here.

My question is :
What are the exact rules which make this warning appear in a dialog box ?


Using Chromium/Ubuntu (version 17.0.963.26), the threshold seems to be only the delay between two dialog boxes.

You can test this from jsfiddle here (thx Rory McCrossan)


The exact rule(s): A timed interval between the dialog boxes popping up. The value used to determine this is set in SUCCESSIVE_DIALOG_TIME_LIMIT

Check out line 2614 in the link below the snippet:


TimeDuration dialogDuration(TimeStamp::Now() - topWindow->mLastDialogQuitTime);

if (dialogDuration.ToSeconds() < Preferences::GetInt("dom.successive_dialog_time_limit",SUCCESSIVE_DIALOG_TIME_LIMIT)){topWindow->mDialogAbuseCount++;return (topWindow->GetPopupControlState() > openAllowed || topWindow->mDialogAbuseCount > MAX_DIALOG_COUNT);}topWindow->mDialogAbuseCount = 0; return false;}

Link to source