Bug 1506026 - Don't accidentally hide the navigator-toolbox if fullscreen has been exited. r=jaws
authorMike Conley <mconley@mozilla.com>
Wed, 21 Nov 2018 23:28:45 +0000
changeset 506862 b1c8590d5f74c3e4ca3daf8caaf0662e8d126985
parent 506861 373839b9f787786aca3869614d71bcda66bfabf4
child 506863 81a99e4b008c5edf36d54d12d8ef9dd430e4c81c
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)
reviewersjaws
bugs1506026
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 1506026 - Don't accidentally hide the navigator-toolbox if fullscreen has been exited. r=jaws Differential Revision: https://phabricator.services.mozilla.com/D12594
browser/base/content/browser-fullScreenAndPointerLock.js
--- a/browser/base/content/browser-fullScreenAndPointerLock.js
+++ b/browser/base/content/browser-fullScreenAndPointerLock.js
@@ -592,17 +592,23 @@ var FullScreen = {
       // it lose the focus. We cannot listen on "blur" event on focused here
       // because that event can be triggered by "mousedown", and hiding chrome
       // would cause the content to move. This combination may split a single
       // click into two actionless halves.
       let retryHideNavToolbox = () => {
         // Wait for at least a frame to give it a chance to be passed down to
         // the content.
         requestAnimationFrame(() => {
-          setTimeout(() => this.hideNavToolbox(aAnimate), 0);
+          setTimeout(() => {
+            // In the meantime, it's possible that we exited fullscreen somehow,
+            // so only hide the toolbox if we're still in fullscreen mode.
+            if (window.fullScreen) {
+              this.hideNavToolbox(aAnimate);
+            }
+          }, 0);
         });
         window.removeEventListener("keypress", retryHideNavToolbox);
         window.removeEventListener("click", retryHideNavToolbox);
       };
       window.addEventListener("keypress", retryHideNavToolbox);
       window.addEventListener("click", retryHideNavToolbox);
       return;
     }