Bug 1653160 - Avoid re-raising the PuppetWidget of an already-focused OOP iframe upon click. r=nika
authorHenri Sivonen <hsivonen@hsivonen.fi>
Wed, 26 Aug 2020 15:53:31 +0000
changeset 546408 b162b405a551f4754a16078ea714b9fc75e7d093
parent 546407 cd3fdb1847612bdf781bedfb6fa250696ade3555
child 546409 998f1372ebe074fb48bb77374c65d7e769b4bf6d
push id37735
push userabutkovits@mozilla.com
push dateThu, 27 Aug 2020 21:29:40 +0000
treeherdermozilla-central@109f3a4de567 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnika
bugs1653160
milestone82.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 1653160 - Avoid re-raising the PuppetWidget of an already-focused OOP iframe upon click. r=nika Differential Revision: https://phabricator.services.mozilla.com/D87859
dom/base/nsFocusManager.cpp
--- a/dom/base/nsFocusManager.cpp
+++ b/dom/base/nsFocusManager.cpp
@@ -2722,21 +2722,23 @@ void nsFocusManager::RaiseWindow(nsPIDOM
     return;
   }
 
   if (XRE_IsParentProcess()) {
     if (aWindow == mActiveWindow) {
       return;
     }
   } else {
-    // We can only test for top-level Web content. We can't return
-    // early for out-of-process iframes, because when they need to
-    // to be "raised", their top-level Web content may already be
-    // "raised".
-    if (aWindow->GetBrowsingContext() == GetActiveBrowsingContext()) {
+    BrowsingContext* bc = aWindow->GetBrowsingContext();
+    // TODO: Deeper OOP frame hierarchies are
+    // https://bugzilla.mozilla.org/show_bug.cgi?id=1661227
+    if (bc == GetActiveBrowsingContext()) {
+      return;
+    }
+    if (bc == GetFocusedBrowsingContext()) {
       return;
     }
   }
 
   if (sTestMode) {
     // In test mode, emulate raising the window. WindowRaised takes
     // care of lowering the present active window. This happens in
     // a separate runnable to avoid touching multiple windows in