Bug 1503887 - clear focused window when Blur() is called and there's no docshell, presshell, or the focused element is no longer in the composed document r=NeilDeakin
authorGijs Kruitbosch <gijskruitbosch@gmail.com>
Fri, 07 Dec 2018 09:00:28 +0000
changeset 508801 ce34faf0d1ef5d62b9d1021c1bcf7e66cc3b8620
parent 508800 5344a9d4ec9ca4a27fce29328183d1dc06ebd441
child 508809 53ae338e03a08e1726899c3b36e0b96f1745a729
push id1905
push userffxbld-merge
push dateMon, 21 Jan 2019 12:33:13 +0000
treeherdermozilla-release@c2fca1944d8c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersNeilDeakin
bugs1503887
milestone65.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 1503887 - clear focused window when Blur() is called and there's no docshell, presshell, or the focused element is no longer in the composed document r=NeilDeakin Differential Revision: https://phabricator.services.mozilla.com/D13655
dom/base/nsFocusManager.cpp
toolkit/components/printing/tests/browser.ini
--- a/dom/base/nsFocusManager.cpp
+++ b/dom/base/nsFocusManager.cpp
@@ -1551,25 +1551,27 @@ bool nsFocusManager::Blur(nsPIDOMWindowO
   nsCOMPtr<nsPIDOMWindowOuter> window = mFocusedWindow;
   if (!window) {
     mFocusedElement = nullptr;
     return true;
   }
 
   nsCOMPtr<nsIDocShell> docShell = window->GetDocShell();
   if (!docShell) {
+    mFocusedWindow = nullptr;
     mFocusedElement = nullptr;
     return true;
   }
 
   // Keep a ref to presShell since dispatching the DOM event may cause
   // the document to be destroyed.
   nsCOMPtr<nsIPresShell> presShell = docShell->GetPresShell();
   if (!presShell) {
     mFocusedElement = nullptr;
+    mFocusedWindow = nullptr;
     return true;
   }
 
   bool clearFirstBlurEvent = false;
   if (!mFirstBlurEvent) {
     mFirstBlurEvent = element;
     clearFirstBlurEvent = true;
   }
--- a/toolkit/components/printing/tests/browser.ini
+++ b/toolkit/components/printing/tests/browser.ini
@@ -2,14 +2,14 @@
 support-files =
   file_page_change_print_original_1.html
   file_page_change_print_original_2.html
 skip-if = os == "mac"
 
 [browser_preview_print_simplify_non_article.js]
 support-files =
     simplifyNonArticleSample.html
-skip-if = os == "mac" || (verify && (os == 'win' || os == 'linux')) || (debug && os == 'linux') # linux debug due to leaks, bug 1503887
+skip-if = os == "mac" || (verify && (os == 'win' || os == 'linux'))
 
 [browser_preview_switch_print_selected.js]
 support-files =
     simplifyArticleSample.html
-skip-if = os == "mac" || (verify && !debug && (os == 'linux')) || (debug && os == 'linux') # linux debug due to leaks, bug 1503887
\ No newline at end of file
+skip-if = os == "mac" || (verify && !debug && (os == 'linux'))