|
|
701521f |
|
|
|
701521f |
Do not disable interrupt callbacks while showing slow script dialog(s).
|
|
|
701521f |
|
|
|
701521f |
|
|
|
701521f |
It is likely that a site can have more than one slow script, running simultaneously.
|
|
|
701521f |
It seems that since 2.53.9 each such a script has its own watchdog interrupt.
|
|
|
701521f |
And it is likely such interrupts are happen at the same or near time.
|
|
|
701521f |
|
|
|
701521f |
If the interrupt callbacks are disabled during the handle of the first interrupt,
|
|
|
1758794 |
other scripts seem continue to run. Such still running scripts can put a lot of things
|
|
|
701521f |
into the main thread's event queue, which cause SpinEventLoopUntil() in
|
|
|
701521f |
xpfe/appshell/nsXULWindow.cpp:nsXULWindow::ShowModal() to loop forever, and
|
|
|
701521f |
the dialog window does not appear.
|
|
|
701521f |
|
|
|
701521f |
The assumption above is inspired by testing the case of "never appearing slow script dialog"
|
|
|
701521f |
for the url of https://www.dw.com/de/spaniens-erster-lockdown-war-verfassungswidrig/a-58270280
|
|
|
701521f |
(for the time of writing this text).
|
|
|
701521f |
|
|
|
701521f |
|
|
|
701521f |
This solution looks safe as it only affects the slow script dialog
|
|
|
701521f |
(and the dropped statement only exists in one another place in the entire code).
|
|
|
701521f |
Predecessors of the dropped statement (with the same comment) was introduced in bug 477187.
|
|
|
701521f |
E10S code use another path at all.
|
|
|
701521f |
|
|
|
701521f |
In practice, the ability to halt slow scripts is much preferable
|
|
|
701521f |
to the theoretical risk of recursively invoking the interrupt callback.
|
|
|
701521f |
|
|
|
701521f |
|
|
|
701521f |
--- dom/base/nsGlobalWindow.cpp.orig 2021-10-26 19:49:54.000000000 +0300
|
|
|
701521f |
+++ dom/base/nsGlobalWindow.cpp 2021-11-23 01:53:46.594328776 +0300
|
|
|
701521f |
@@ -11947,26 +11947,22 @@ nsGlobalWindow::ShowSlowScriptDialog(con
|
|
|
701521f |
(nsIPrompt::BUTTON_POS_0 + nsIPrompt::BUTTON_POS_1));
|
|
|
701521f |
|
|
|
701521f |
// Add a third button if necessary.
|
|
|
701521f |
if (showDebugButton)
|
|
|
701521f |
buttonFlags += nsIPrompt::BUTTON_TITLE_IS_STRING * nsIPrompt::BUTTON_POS_2;
|
|
|
701521f |
|
|
|
701521f |
bool checkboxValue = false;
|
|
|
701521f |
int32_t buttonPressed = 0; // In case the user exits dialog by clicking X.
|
|
|
701521f |
- {
|
|
|
701521f |
- // Null out the operation callback while we're re-entering JS here.
|
|
|
701521f |
- AutoDisableJSInterruptCallback disabler(cx);
|
|
|
701521f |
|
|
|
701521f |
- // Open the dialog.
|
|
|
701521f |
- rv = prompt->ConfirmEx(title.get(), msg.get(), buttonFlags,
|
|
|
701521f |
- waitButton.get(), stopButton.get(),
|
|
|
701521f |
- debugButton.get(), checkboxMsg.get(),
|
|
|
701521f |
- &checkboxValue, &buttonPressed);
|
|
|
701521f |
- }
|
|
|
701521f |
+ // Open the dialog.
|
|
|
701521f |
+ rv = prompt->ConfirmEx(title.get(), msg.get(), buttonFlags,
|
|
|
701521f |
+ waitButton.get(), stopButton.get(),
|
|
|
701521f |
+ debugButton.get(), checkboxMsg.get(),
|
|
|
701521f |
+ &checkboxValue, &buttonPressed);
|
|
|
701521f |
|
|
|
701521f |
if (buttonPressed == 0) {
|
|
|
701521f |
if (checkboxValue && !isAddonScript && NS_SUCCEEDED(rv))
|
|
|
701521f |
return AlwaysContinueSlowScript;
|
|
|
701521f |
return ContinueSlowScript;
|
|
|
701521f |
}
|
|
|
701521f |
|
|
|
701521f |
if (buttonPressed == 2) {
|