Backed out changeset 99e6a5b3b079 (bug 933483) for mochitest-bc leaks.

CLOSED TREE
This commit is contained in:
Ryan VanderMeulen 2013-12-16 11:09:54 -05:00
parent 3cae916dff
commit 7f28d9919b
3 changed files with 14 additions and 29 deletions

View File

@ -8565,17 +8565,11 @@ FireOrClearDelayedEvents(nsTArray<nsCOMPtr<nsIDocument> >& aDocuments,
return;
for (uint32_t i = 0; i < aDocuments.Length(); ++i) {
// NB: Don't bother trying to fire delayed events on documents that were
// closed before this event ran.
if (!aDocuments[i]->EventHandlingSuppressed()) {
fm->FireDelayedEvents(aDocuments[i]);
nsCOMPtr<nsIPresShell> shell = aDocuments[i]->GetShell();
if (shell) {
// Only fire events for active documents.
bool fire = aFireEvents &&
aDocuments[i]->GetInnerWindow() &&
aDocuments[i]->GetInnerWindow()->IsCurrentInnerWindow();
shell->FireOrClearDelayedEvents(fire);
shell->FireOrClearDelayedEvents(aFireEvents);
}
}
}

View File

@ -992,23 +992,16 @@ nsFocusManager::FireDelayedEvents(nsIDocument* aDocument)
NS_ENSURE_ARG(aDocument);
// fire any delayed focus and blur events in the same order that they were added
for (uint32_t i = 0; i < mDelayedBlurFocusEvents.Length(); i++) {
if (mDelayedBlurFocusEvents[i].mDocument == aDocument) {
if (!aDocument->GetInnerWindow() ||
!aDocument->GetInnerWindow()->IsCurrentInnerWindow()) {
// If the document was navigated away from or is defunct, don't bother
// firing events on it. Note the symmetry between this condition and
// the similar one in nsDocument.cpp:FireOrClearDelayedEvents.
mDelayedBlurFocusEvents.RemoveElementAt(i);
--i;
} else if (!aDocument->EventHandlingSuppressed()) {
uint32_t type = mDelayedBlurFocusEvents[i].mType;
nsCOMPtr<EventTarget> target = mDelayedBlurFocusEvents[i].mTarget;
nsCOMPtr<nsIPresShell> presShell = mDelayedBlurFocusEvents[i].mPresShell;
mDelayedBlurFocusEvents.RemoveElementAt(i);
SendFocusOrBlurEvent(type, presShell, aDocument, target, 0, false);
--i;
}
for (uint32_t i = 0; i < mDelayedBlurFocusEvents.Length(); i++)
{
if (mDelayedBlurFocusEvents[i].mDocument == aDocument &&
!aDocument->EventHandlingSuppressed()) {
uint32_t type = mDelayedBlurFocusEvents[i].mType;
nsCOMPtr<EventTarget> target = mDelayedBlurFocusEvents[i].mTarget;
nsCOMPtr<nsIPresShell> presShell = mDelayedBlurFocusEvents[i].mPresShell;
mDelayedBlurFocusEvents.RemoveElementAt(i);
SendFocusOrBlurEvent(type, presShell, aDocument, target, 0, false);
--i;
}
}

View File

@ -1545,10 +1545,6 @@ nsGlobalWindow::FreeInnerObjects()
mDocumentPrincipal = mDoc->NodePrincipal();
mDocumentURI = mDoc->GetDocumentURI();
mDocBaseURI = mDoc->GetDocBaseURI();
if (mDoc->EventHandlingSuppressed()) {
mDoc->UnsuppressEventHandlingAndFireEvents(false);
}
}
// Remove our reference to the document and the document principal.
@ -8208,8 +8204,10 @@ nsGlobalWindow::EnterModalState()
NS_ASSERTION(!mSuspendedDoc, "Shouldn't have mSuspendedDoc here!");
mSuspendedDoc = topWin->GetExtantDoc();
if (mSuspendedDoc) {
if (mSuspendedDoc && mSuspendedDoc->EventHandlingSuppressed()) {
mSuspendedDoc->SuppressEventHandling();
} else {
mSuspendedDoc = nullptr;
}
}
topWin->mModalStateDepth++;