Bug 1306696 - Part 3: Exit fullscreen in non-e10s when no fullscreen request is proceeded. r=smaug, a=ritu
authorXidorn Quan <me@upsuper.org>
Thu, 06 Oct 2016 10:48:32 +1100
changeset 350595 b9a54c39bedd819d6e1599a47e5dfb619a9f73eb
parent 350594 2a7a36b41b82913f397261561cb710f7719416de
child 350596 49776d31766dd130969f9ec4ea3354a43e8e6d9d
push id1230
push userjlund@mozilla.com
push dateMon, 31 Oct 2016 18:13:35 +0000
treeherdermozilla-release@5e06e3766db2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug, ritu
bugs1306696
milestone50.0
Bug 1306696 - Part 3: Exit fullscreen in non-e10s when no fullscreen request is proceeded. r=smaug, a=ritu MozReview-Commit-ID: AKCwRqAImc6
dom/base/nsGlobalWindow.cpp
--- a/dom/base/nsGlobalWindow.cpp
+++ b/dom/base/nsGlobalWindow.cpp
@@ -6143,22 +6143,26 @@ nsGlobalWindow::SetFullScreen(bool aFull
 nsresult
 nsGlobalWindow::SetFullScreen(bool aFullScreen)
 {
   FORWARD_TO_OUTER(SetFullScreen, (aFullScreen), NS_ERROR_NOT_INITIALIZED);
 
   return SetFullscreenInternal(FullscreenReason::ForFullscreenMode, aFullScreen);
 }
 
-void
+static void
 FinishDOMFullscreenChange(nsIDocument* aDoc, bool aInDOMFullscreen)
 {
   if (aInDOMFullscreen) {
     // Ask the document to handle any pending DOM fullscreen change.
-    nsIDocument::HandlePendingFullscreenRequests(aDoc);
+    if (!nsIDocument::HandlePendingFullscreenRequests(aDoc)) {
+      // If we don't end up having anything in fullscreen,
+      // async request exiting fullscreen.
+      nsIDocument::AsyncExitFullscreen(aDoc);
+    }
   } else {
     // If the window is leaving fullscreen state, also ask the document
     // to exit from DOM Fullscreen.
     nsIDocument::ExitFullscreenInDocTree(aDoc);
   }
 }
 
 struct FullscreenTransitionDuration