From 193b1bbe0720a5a9a049730f0bcf7c1e67e4de30 Mon Sep 17 00:00:00 2001 From: Eric Rahm Date: Fri, 31 Jul 2015 13:23:15 -0700 Subject: [PATCH] Bug 1183845 - Only send activation event if document is non-null. r=bz --- dom/base/nsFocusManager.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/dom/base/nsFocusManager.cpp b/dom/base/nsFocusManager.cpp index caf6008593c..550dffebe46 100644 --- a/dom/base/nsFocusManager.cpp +++ b/dom/base/nsFocusManager.cpp @@ -1134,12 +1134,14 @@ nsFocusManager::ActivateOrDeactivate(nsPIDOMWindow* aWindow, bool aActive) 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,