Bug 933483 - Don't fire events (and especially request animation frame events) when we're in a modal dialog. Also protect ourselves from resuming events on a closed window. r=smaug

This commit is contained in:
Blake Kaplan 2013-12-02 15:38:36 -08:00
parent f577979fe4
commit 72f57b32df
3 changed files with 7 additions and 6 deletions

View File

@ -8490,7 +8490,10 @@ FireOrClearDelayedEvents(nsTArray<nsCOMPtr<nsIDocument> >& aDocuments,
return;
for (uint32_t i = 0; i < aDocuments.Length(); ++i) {
if (!aDocuments[i]->EventHandlingSuppressed()) {
// NB: Don't bother trying to fire delayed events on documents that were
// closed before this event ran.
if (!aDocuments[i]->EventHandlingSuppressed() &&
aDocuments[i]->IsActive()) {
fm->FireDelayedEvents(aDocuments[i]);
nsCOMPtr<nsIPresShell> shell = aDocuments[i]->GetShell();
if (shell) {

View File

@ -8185,10 +8185,8 @@ nsGlobalWindow::EnterModalState()
NS_ASSERTION(!mSuspendedDoc, "Shouldn't have mSuspendedDoc here!");
mSuspendedDoc = topWin->GetExtantDoc();
if (mSuspendedDoc && mSuspendedDoc->EventHandlingSuppressed()) {
if (mSuspendedDoc) {
mSuspendedDoc->SuppressEventHandling();
} else {
mSuspendedDoc = nullptr;
}
}
topWin->mModalStateDepth++;
@ -8202,7 +8200,8 @@ nsGlobalWindow::RunPendingTimeoutsRecursive(nsGlobalWindow *aTopWindow,
nsGlobalWindow *inner;
// Return early if we're frozen or have no inner window.
if (!(inner = aWindow->GetCurrentInnerWindowInternal()) ||
if (aWindow->IsClosedOrClosing() ||
!(inner = aWindow->GetCurrentInnerWindowInternal()) ||
inner->IsFrozen()) {
return;
}

View File

@ -21,7 +21,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=61098
<script class="testbody" type="text/javascript">
/** Test for Bug 61098 **/
SimpleTest.expectAssertions(8);
SimpleTest.waitForExplicitFinish();
var mockPromptServiceRegisterer, mockPromptFactoryRegisterer;