Bug 959585, clear capturing content before entering modal state, r=mrbkap, f=enn

--HG--
extra : rebase_source : 31d6fa26fbabd6cdded638fa24d946f9f9d97a13
This commit is contained in:
Olli Pettay 2014-01-28 09:15:47 -08:00
parent bf5779d924
commit d8fb2aa926

View File

@ -8225,10 +8225,20 @@ nsGlobalWindow::EnterModalState()
}
}
// Clear the capturing content if it is under topDoc.
// Usually the activeESM check above does that, but there are cases when
// we don't have activeESM, or it is for different document.
nsIDocument* topDoc = topWin->GetExtantDoc();
nsIContent* capturingContent = nsIPresShell::GetCapturingContent();
if (capturingContent && topDoc &&
nsContentUtils::ContentIsCrossDocDescendantOf(capturingContent, topDoc)) {
nsIPresShell::SetCapturingContent(nullptr, 0);
}
if (topWin->mModalStateDepth == 0) {
NS_ASSERTION(!mSuspendedDoc, "Shouldn't have mSuspendedDoc here!");
mSuspendedDoc = topWin->GetExtantDoc();
mSuspendedDoc = topDoc;
if (mSuspendedDoc) {
mSuspendedDoc->SuppressEventHandling();
}