Bug 578150: Protect against the docshell loosing its document before we've had time to notify on it. r=mrbkap a=LegNeato
authorJonas Sicking <jonas@sicking.cc>
Mon, 12 Jul 2010 14:56:34 -0700
changeset 34427 d6d2c572d791f8f78aba047f0bd4dff55903ec00
parent 34425 f0a353fe15d79e5d865ad35d32d179d638ec2fb4
child 34432 91d35aa7ca2190bf4883ee1f6e95e449158b4305
push id1461
push usersicking@mozilla.com
push dateMon, 12 Jul 2010 22:07:36 +0000
reviewersmrbkap, LegNeato
bugs578150
milestone1.9.2.8pre
Bug 578150: Protect against the docshell loosing its document before we've had time to notify on it. r=mrbkap a=LegNeato
dom/base/nsGlobalWindow.cpp
--- a/dom/base/nsGlobalWindow.cpp
+++ b/dom/base/nsGlobalWindow.cpp
@@ -2088,16 +2088,20 @@ nsGlobalWindow::SetNewDocument(nsIDocume
   mMutationBits = 0;
 
   return NS_OK;
 }
 
 void
 nsGlobalWindow::DispatchDOMWindowCreated()
 {
+  if (!mDoc || !mDocument) {
+    return;
+  }
+
   // Fire DOMWindowCreated at chrome event listeners
   nsContentUtils::DispatchChromeEvent(mDoc, mDocument, NS_LITERAL_STRING("DOMWindowCreated"),
                                       PR_TRUE /* bubbles */,
                                       PR_FALSE /* not cancellable */);
 
   nsCOMPtr<nsIObserverService> observerService =
     do_GetService("@mozilla.org/observer-service;1");
   if (observerService) {