Bug 1567355 - Admit that exiting fullscreen can fail on macOS. r=smaug
authorXidorn Quan <me@upsuper.org>
Mon, 30 Sep 2019 12:35:45 +0000
changeset 495590 b7f164bc7e798da99863a7b5b976cb114fa2f46d
parent 495589 d8602fcecc75264a5b7156e68f41dd599bf9487f
child 495591 37edb4f96fccf4d078d32edf2dec32cdeab2d387
push id96706
push usermozilla@upsuper.org
push dateMon, 30 Sep 2019 12:41:48 +0000
treeherderautoland@b7f164bc7e79 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs1567355
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 1567355 - Admit that exiting fullscreen can fail on macOS. r=smaug Differential Revision: https://phabricator.services.mozilla.com/D47525
browser/base/content/test/general/browser.ini
dom/base/nsGlobalWindowOuter.cpp
--- a/browser/base/content/test/general/browser.ini
+++ b/browser/base/content/test/general/browser.ini
@@ -271,17 +271,17 @@ skip-if = (verify && !debug && (os == 'l
 skip-if = true # browser_drag.js is disabled, as it needs to be updated for the new behavior from bug 320638.
 # DO NOT ADD MORE TESTS HERE. USE A TOPICAL DIRECTORY INSTEAD.
 [browser_findbarClose.js]
 # DO NOT ADD MORE TESTS HERE. USE A TOPICAL DIRECTORY INSTEAD.
 [browser_focusonkeydown.js]
 # DO NOT ADD MORE TESTS HERE. USE A TOPICAL DIRECTORY INSTEAD.
 [browser_fullscreen-window-open.js]
 tags = fullscreen
-skip-if = os == "linux" || (os == "mac" && debug) # Linux: Intermittent failures - bug 941575. # Assertion failures in Bug 1567355
+skip-if = os == "linux" # Linux: Intermittent failures - bug 941575.
 # DO NOT ADD MORE TESTS HERE. USE A TOPICAL DIRECTORY INSTEAD.
 [browser_gestureSupport.js]
 skip-if = e10s # Bug 863514 - no gesture support.
 # DO NOT ADD MORE TESTS HERE. USE A TOPICAL DIRECTORY INSTEAD.
 [browser_hide_removing.js]
 # DO NOT ADD MORE TESTS HERE. USE A TOPICAL DIRECTORY INSTEAD.
 [browser_homeDrop.js]
 # DO NOT ADD MORE TESTS HERE. USE A TOPICAL DIRECTORY INSTEAD.
--- a/dom/base/nsGlobalWindowOuter.cpp
+++ b/dom/base/nsGlobalWindowOuter.cpp
@@ -4491,21 +4491,25 @@ void nsGlobalWindowOuter::FinishFullscre
   if (aIsFullscreen != mFullscreen) {
     NS_WARNING("Failed to toggle fullscreen state of the widget");
     // We failed to make the widget enter fullscreen.
     // Stop further changes and restore the state.
     if (!aIsFullscreen) {
       mFullscreen = false;
       mFullscreenMode = false;
     } else {
+#ifndef XP_MACOSX
       MOZ_ASSERT_UNREACHABLE("Failed to exit fullscreen?");
+#endif
       mFullscreen = true;
-      // We don't know how code can reach here. Not sure
-      // what value should be set for fullscreen mode.
-      mFullscreenMode = false;
+      // At least on macOS, we may reach here because the system fails
+      // to let us exit the system fullscreen mode. In that case, we may
+      // have already exited DOM fullscreen before, so set fullscreen
+      // mode to true here so that it has a saner state.
+      mFullscreenMode = true;
     }
     return;
   }
 
   // Note that we must call this to toggle the DOM fullscreen state
   // of the document before dispatching the "fullscreen" event, so
   // that the chrome can distinguish between browser fullscreen mode
   // and DOM fullscreen.