From f54a5ea9f715e9a7ae8a5d1112151e81a715e13b Mon Sep 17 00:00:00 2001 From: Olli Pettay Date: Thu, 10 Jun 2010 13:29:43 +0300 Subject: [PATCH] Bug 562901 - Synchronous XMLHttpRequests cause setInterval to stop functioning, r=jst --- dom/base/nsGlobalWindow.cpp | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/dom/base/nsGlobalWindow.cpp b/dom/base/nsGlobalWindow.cpp index e98491a77db..b4484cbd42b 100644 --- a/dom/base/nsGlobalWindow.cpp +++ b/dom/base/nsGlobalWindow.cpp @@ -9262,10 +9262,18 @@ nsGlobalWindow::SuspendTimeouts(PRUint32 aIncrease, nsGlobalWindow *win = static_cast (static_cast(pWin)); - win->SuspendTimeouts(aIncrease, aFreezeChildren); - NS_ASSERTION(win->IsOuterWindow(), "Expected outer window"); nsGlobalWindow* inner = win->GetCurrentInnerWindowInternal(); + + // This is a bit hackish. Only freeze/suspend windows which are truly our + // subwindows. + nsCOMPtr frame = do_QueryInterface(pWin->GetFrameElementInternal()); + if (!mDoc || !frame || mDoc != frame->GetOwnerDoc() || !inner) { + continue; + } + + win->SuspendTimeouts(aIncrease, aFreezeChildren); + if (inner && aFreezeChildren) { inner->Freeze(); } @@ -9359,6 +9367,14 @@ nsGlobalWindow::ResumeTimeouts(PRBool aThawChildren) NS_ASSERTION(win->IsOuterWindow(), "Expected outer window"); nsGlobalWindow* inner = win->GetCurrentInnerWindowInternal(); + + // This is a bit hackish. Only thaw/resume windows which are truly our + // subwindows. + nsCOMPtr frame = do_QueryInterface(pWin->GetFrameElementInternal()); + if (!mDoc || !frame || mDoc != frame->GetOwnerDoc() || !inner) { + continue; + } + if (inner && aThawChildren) { inner->Thaw(); }