Bug 1432856 - Added prefs for DOM fullscreen leave on window open or raise. r=smaug
☠☠ backed out by d94afce0c18b ☠ ☠
authorpbz <pbz@mozilla.com>
Mon, 16 Dec 2019 21:07:33 +0000
changeset 507297 a8a4fa63f5b20f2dcc0b11e0496076e435c7e83c
parent 507296 c81f3d5b9bf33e648b9d7b4e427d1c9a8a10c38e
child 507298 62fc84c8ce9978f4df6d65ac6e8d8e4939b0bb65
push id103347
push userpzuhlcke@mozilla.com
push dateMon, 16 Dec 2019 21:26:02 +0000
treeherderautoland@3d08c3cce533 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs1432856
milestone73.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 1432856 - Added prefs for DOM fullscreen leave on window open or raise. r=smaug Differential Revision: https://phabricator.services.mozilla.com/D55812
dom/base/nsFocusManager.cpp
modules/libpref/init/StaticPrefList.yaml
toolkit/components/windowwatcher/nsWindowWatcher.cpp
--- a/dom/base/nsFocusManager.cpp
+++ b/dom/base/nsFocusManager.cpp
@@ -55,16 +55,17 @@
 #include "mozilla/EventStates.h"
 #include "mozilla/HTMLEditor.h"
 #include "mozilla/IMEStateManager.h"
 #include "mozilla/LookAndFeel.h"
 #include "mozilla/Preferences.h"
 #include "mozilla/PresShell.h"
 #include "mozilla/Services.h"
 #include "mozilla/Unused.h"
+#include "mozilla/StaticPrefs_full_screen_api.h"
 #include <algorithm>
 
 #ifdef MOZ_XUL
 #  include "nsIDOMXULMenuListElement.h"
 #endif
 
 #ifdef ACCESSIBILITY
 #  include "nsAccessibilityService.h"
@@ -1232,18 +1233,18 @@ void nsFocusManager::SetFocusInner(Eleme
     nsCOMPtr<nsIDocShellTreeItem> root;
     dsti->GetInProcessRootTreeItem(getter_AddRefs(root));
     newRootWindow = root ? root->GetWindow() : nullptr;
 
     isElementInActiveWindow = (mActiveWindow && newRootWindow == mActiveWindow);
   }
 
   // Exit fullscreen if a website focuses another window
-  if (!isElementInActiveWindow &&
-      aFlags & (FLAG_RAISE | FLAG_NONSYSTEMCALLER)) {
+  if (StaticPrefs::full_screen_api_exit_on_windowRaise() &&
+      !isElementInActiveWindow && aFlags & (FLAG_RAISE | FLAG_NONSYSTEMCALLER)) {
     if (Document* doc = mActiveWindow ? mActiveWindow->GetDoc() : nullptr) {
       if (doc->GetFullscreenElement()) {
         Document::AsyncExitFullscreen(doc);
       }
     }
   }
 
   // Exit fullscreen if we're focusing a windowed plugin on a non-MacOSX
--- a/modules/libpref/init/StaticPrefList.yaml
+++ b/modules/libpref/init/StaticPrefList.yaml
@@ -3073,16 +3073,26 @@
   value: true
   mirror: always
 
 - name: full-screen-api.mouse-event-allow-left-button-only
   type: bool
   value: true
   mirror: always
 
+- name: full-screen-api.exit-on.windowOpen
+  type: bool
+  value: true
+  mirror: always
+
+- name: full-screen-api.exit-on.windowRaise
+  type: bool
+  value: true
+  mirror: always
+
 #---------------------------------------------------------------------------
 # Prefs starting with "fuzzing.". It's important that these can only be
 # checked in fuzzing builds (when FUZZING is defined), otherwise you could
 # enable the fuzzing stuff on your regular build which would be bad :)
 #---------------------------------------------------------------------------
 
 #ifdef FUZZING
 -   name: fuzzing.enabled
--- a/toolkit/components/windowwatcher/nsWindowWatcher.cpp
+++ b/toolkit/components/windowwatcher/nsWindowWatcher.cpp
@@ -56,16 +56,17 @@
 #include "nsSandboxFlags.h"
 #include "nsSimpleEnumerator.h"
 #include "mozilla/BasePrincipal.h"
 #include "mozilla/CheckedInt.h"
 #include "mozilla/NullPrincipal.h"
 #include "mozilla/Preferences.h"
 #include "mozilla/ResultExtensions.h"
 #include "mozilla/StaticPrefs_fission.h"
+#include "mozilla/StaticPrefs_full_screen_api.h"
 #include "mozilla/dom/Element.h"
 #include "mozilla/dom/Storage.h"
 #include "mozilla/dom/ScriptSettings.h"
 #include "mozilla/dom/BrowserParent.h"
 #include "mozilla/dom/BrowserHost.h"
 #include "mozilla/dom/DocGroup.h"
 #include "mozilla/dom/TabGroup.h"
 #include "nsIAppWindow.h"
@@ -1305,18 +1306,19 @@ nsresult nsWindowWatcher::OpenWindowInte
       // being active the whole time a modal dialog is open.
       AutoPopupStatePusher popupStatePusher(PopupBlocker::openAbused);
 
       newChrome->ShowAsModal();
     }
   }
 
   // If a website opens a popup exit DOM fullscreen
-  if (aCalledFromJS && !nsContentUtils::LegacyIsCallerChromeOrNativeCode() &&
-      parentWindow && parentWindow->GetFullScreen()) {
+  if (StaticPrefs::full_screen_api_exit_on_windowOpen() && aCalledFromJS &&
+      !nsContentUtils::LegacyIsCallerChromeOrNativeCode() && parentWindow &&
+      parentWindow->GetFullScreen()) {
     nsCOMPtr<nsPIDOMWindowOuter> parentTopWindow =
         parentWindow->GetBrowsingContext()->Top()->GetDOMWindow();
     if (Document* doc = parentTopWindow ? parentTopWindow->GetDoc() : nullptr) {
       if (doc->GetFullscreenElement()) {
         Document::AsyncExitFullscreen(doc);
         // TODO: nsContentUtils::ReportToConsole
       }
     }