Bug 1183845 - Only send activation event if document is non-null. r=bz
authorEric Rahm <erahm@mozilla.com>
Fri, 31 Jul 2015 13:23:15 -0700
changeset 287405 829ee40cf65526c7b1b96b289be9f11d3a9d05f5
parent 287404 829561e0df63f17eaf43ad4c03a1720c7b230507
child 287406 cebec1f7c9dba4fe6d17270ae905108695396ba4
push id5067
push userraliiev@mozilla.com
push dateMon, 21 Sep 2015 14:04:52 +0000
treeherdermozilla-beta@14221ffe5b2f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbz
bugs1183845
milestone42.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 1183845 - Only send activation event if document is non-null. r=bz
dom/base/nsFocusManager.cpp
--- a/dom/base/nsFocusManager.cpp
+++ b/dom/base/nsFocusManager.cpp
@@ -1129,22 +1129,24 @@ nsFocusManager::ActivateOrDeactivate(nsP
     return;
   }
 
   // Inform the DOM window that it has activated or deactivated, so that
   // the active attribute is updated on the window.
   aWindow->ActivateOrDeactivate(aActive);
 
   // Send the activate event.
-  nsContentUtils::DispatchEventOnlyToChrome(aWindow->GetExtantDoc(),
-                                            aWindow,
-                                            aActive ?
-                                              NS_LITERAL_STRING("activate") :
-                                              NS_LITERAL_STRING("deactivate"),
-                                            true, true, nullptr);
+  if (aWindow->GetExtantDoc()) {
+    nsContentUtils::DispatchEventOnlyToChrome(aWindow->GetExtantDoc(),
+                                              aWindow,
+                                              aActive ?
+                                                NS_LITERAL_STRING("activate") :
+                                                NS_LITERAL_STRING("deactivate"),
+                                              true, true, nullptr);
+  }
 
   // Look for any remote child frames, iterate over them and send the activation notification.
   nsContentUtils::CallOnAllRemoteChildren(aWindow, ActivateOrDeactivateChild,
                                           (void *)aActive);
 }
 
 void
 nsFocusManager::SetFocusInner(nsIContent* aNewContent, int32_t aFlags,