Bug 1356755 - Don't pass a null pointer to NotifyDocumentTree(); r=qdot
authorEhsan Akhgari <ehsan@mozilla.com>
Sat, 15 Apr 2017 00:56:46 -0400
changeset 563372 7c9e059fe6da793ec1f20f1cf7ba1d45cb8ab4a8
parent 563371 3f319382720cc8fa8257b25b7513546e6113791e
child 563373 e9539186b181407d2481f7b5792cb0267ae1b7b7
push id54271
push usermaglione.k@gmail.com
push dateSun, 16 Apr 2017 16:28:54 +0000
reviewersqdot
bugs1356755
milestone55.0a1
Bug 1356755 - Don't pass a null pointer to NotifyDocumentTree(); r=qdot
dom/base/nsGlobalWindow.cpp
--- a/dom/base/nsGlobalWindow.cpp
+++ b/dom/base/nsGlobalWindow.cpp
@@ -10475,17 +10475,19 @@ NotifyDocumentTree(nsIDocument* aDocumen
   aDocument->DocumentStatesChanged(NS_DOCUMENT_STATE_WINDOW_INACTIVE);
   return true;
 }
 
 void
 nsGlobalWindow::SetActive(bool aActive)
 {
   nsPIDOMWindow::SetActive(aActive);
-  NotifyDocumentTree(mDoc, nullptr);
+  if (mDoc) {
+    NotifyDocumentTree(mDoc, nullptr);
+  }
 }
 
 bool
 nsGlobalWindow::IsTopLevelWindowActive()
 {
    nsCOMPtr<nsIDocShellTreeItem> treeItem(GetDocShell());
    if (!treeItem) {
      return false;