Bug 776497 - Check for null currentInner when deciding to reuse inner windows. r=smaug
authorBobby Holley <bobbyholley@gmail.com>
Tue, 20 Nov 2012 16:32:06 -0800
changeset 113845 62769304221fc2eb50fc0612eb2248a4ef38aaf9
parent 113844 442028081ef4b6bd20eb0d5394a69c3a2241127d
child 113846 18248230e08c2b0c39aee57823246c54f582d044
push id23891
push useremorley@mozilla.com
push dateWed, 21 Nov 2012 15:30:36 +0000
treeherdermozilla-central@905492e644e3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs776497
milestone20.0a1
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 776497 - Check for null currentInner when deciding to reuse inner windows. r=smaug
dom/base/nsGlobalWindow.cpp
--- a/dom/base/nsGlobalWindow.cpp
+++ b/dom/base/nsGlobalWindow.cpp
@@ -1767,17 +1767,20 @@ nsGlobalWindow::SetNewDocument(nsIDocume
 
   /* No mDocShell means we're already been partially closed down.  When that
      happens, setting status isn't a big requirement, so don't. (Doesn't happen
      under normal circumstances, but bug 49615 describes a case.) */
 
   nsContentUtils::AddScriptRunner(
     NS_NewRunnableMethod(this, &nsGlobalWindow::ClearStatus));
 
-  bool reUseInnerWindow = aForceReuseInnerWindow || wouldReuseInnerWindow;
+  // Sometimes, WouldReuseInnerWindow() returns true even if there's no inner
+  // window (see bug 776497). Be safe.
+  bool reUseInnerWindow = (aForceReuseInnerWindow || wouldReuseInnerWindow) &&
+                          GetCurrentInnerWindowInternal();
 
   nsresult rv = NS_OK;
 
   // Set mDocument even if this is an outer window to avoid
   // having to *always* reach into the inner window to find the
   // document.
   mDocument = do_QueryInterface(aDocument);
   mDoc = aDocument;