Bug 562901 - Synchronous XMLHttpRequests cause setInterval to stop functioning, r=jst
authorOlli Pettay <Olli.Pettay@helsinki.fi>
Thu, 10 Jun 2010 13:29:43 +0300
changeset 43465 1181eb2743a9a1483a37cf03cb9fcf03a0ca3edf
parent 43464 39a4da7277b5c9d8243dc894ec86e401209d2220
child 43466 6cd818321c5e967158974c8afde334cebdf25b58
push id1
push userroot
push dateTue, 26 Apr 2011 22:38:44 +0000
treeherdermozilla-beta@bfdb6e623a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjst
bugs562901
milestone1.9.3a5pre
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 562901 - Synchronous XMLHttpRequests cause setInterval to stop functioning, r=jst
dom/base/nsGlobalWindow.cpp
--- a/dom/base/nsGlobalWindow.cpp
+++ b/dom/base/nsGlobalWindow.cpp
@@ -9257,20 +9257,28 @@ nsGlobalWindow::SuspendTimeouts(PRUint32
       node->GetChildAt(i, getter_AddRefs(childShell));
       NS_ASSERTION(childShell, "null child shell");
 
       nsCOMPtr<nsPIDOMWindow> pWin = do_GetInterface(childShell);
       if (pWin) {
         nsGlobalWindow *win =
           static_cast<nsGlobalWindow*>
                      (static_cast<nsPIDOMWindow*>(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<nsIContent> frame = do_QueryInterface(pWin->GetFrameElementInternal());
+        if (!mDoc || !frame || mDoc != frame->GetOwnerDoc() || !inner) {
+          continue;
+        }
+
+        win->SuspendTimeouts(aIncrease, aFreezeChildren);
+
         if (inner && aFreezeChildren) {
           inner->Freeze();
         }
       }
     }
   }
 }
 
@@ -9354,16 +9362,24 @@ nsGlobalWindow::ResumeTimeouts(PRBool aT
       nsCOMPtr<nsPIDOMWindow> pWin = do_GetInterface(childShell);
       if (pWin) {
         nsGlobalWindow *win =
           static_cast<nsGlobalWindow*>
                      (static_cast<nsPIDOMWindow*>(pWin));
 
         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<nsIContent> frame = do_QueryInterface(pWin->GetFrameElementInternal());
+        if (!mDoc || !frame || mDoc != frame->GetOwnerDoc() || !inner) {
+          continue;
+        }
+
         if (inner && aThawChildren) {
           inner->Thaw();
         }
 
         rv = win->ResumeTimeouts(aThawChildren);
         NS_ENSURE_SUCCESS(rv, rv);
       }
     }