Bug 1583665 - Fixed AddonManager.jsm fullscreen check to only cancel installation for DOM fullscreen. r=johannh
authorPaul Zuehlcke <pzuhlcke@mozilla.com>
Wed, 09 Oct 2019 09:28:19 +0000
changeset 496929 96917f5eb072c52c4a9d005d40123d8af1b1354f
parent 496928 b5e0f6f76dd6b71e168419949b3e567e33507788
child 496930 59f0469f5a486ddea7543100b3f335706b072955
push id36671
push usershindli@mozilla.com
push dateWed, 09 Oct 2019 16:04:03 +0000
treeherdermozilla-central@0efb4f268d16 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjohannh
bugs1583665
milestone71.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 1583665 - Fixed AddonManager.jsm fullscreen check to only cancel installation for DOM fullscreen. r=johannh Differential Revision: https://phabricator.services.mozilla.com/D47933
browser/base/content/browser-fullScreenAndPointerLock.js
toolkit/mozapps/extensions/AddonManager.jsm
--- a/browser/base/content/browser-fullScreenAndPointerLock.js
+++ b/browser/base/content/browser-fullScreenAndPointerLock.js
@@ -538,17 +538,17 @@ var FullScreen = {
     // Exit DOM full-screen mode when switching to a different tab.
     gBrowser.tabContainer.addEventListener("TabSelect", this.exitDomFullScreen);
 
     // Add listener to detect when the fullscreen window is re-focused.
     // If a fullscreen window loses focus, we show a warning when the
     // fullscreen window is refocused.
     window.addEventListener("activate", this);
 
-    // Addon installation should be cancelled when entering fullscreen for security and usability reasons.
+    // Addon installation should be cancelled when entering DOM fullscreen for security and usability reasons.
     // Installation prompts in fullscreen can trick the user into installing unwanted addons.
     // In fullscreen the notification box does not have a clear visual association with its parent anymore.
     if (gXPInstallObserver.removeAllNotifications(aBrowser)) {
       // If notifications have been removed, log a warning to the website console
       gXPInstallObserver.logWarningFullScreenInstallBlocked();
     }
 
     PopupNotifications.panel.addEventListener(
--- a/toolkit/mozapps/extensions/AddonManager.jsm
+++ b/toolkit/mozapps/extensions/AddonManager.jsm
@@ -2295,20 +2295,25 @@ var AddonManagerInternal = {
     // passed is in a content type docshell and if so get the outer-browser.
     let topBrowser = aBrowser;
     let docShell = aBrowser.ownerGlobal.docShell;
     if (docShell.itemType == Ci.nsIDocShellTreeItem.typeContent) {
       topBrowser = docShell.chromeEventHandler;
     }
 
     try {
-      if (topBrowser.ownerGlobal.fullScreen) {
-        // Addon installation and the resulting notifications should be blocked in fullscreen for security and usability reasons.
-        // Installation prompts in fullscreen can trick the user into installing unwanted addons.
-        // In fullscreen the notification box does not have a clear visual association with its parent anymore.
+      // Use fullscreenElement to check for DOM fullscreen, while still allowing
+      // macOS fullscreen, which still has a browser chrome.
+      if (topBrowser.ownerDocument.fullscreenElement) {
+        // Addon installation and the resulting notifications should be
+        // blocked in DOM fullscreen for security and usability reasons.
+        // Installation prompts in fullscreen can trick the user into
+        // installing unwanted addons.
+        // In fullscreen the notification box does not have a clear
+        // visual association with its parent anymore.
         aInstall.cancel();
 
         this.installNotifyObservers(
           "addon-install-fullscreen-blocked",
           topBrowser,
           aInstallingPrincipal.URI,
           aInstall
         );