Bug 1189622 part 1 - Ensure the in-fullscreen-change flag is set before calling the second phase. draft
authorXidorn Quan <quanxunzhen@gmail.com>
Mon, 11 Jan 2016 14:15:11 +1100
changeset 320380 ef1bd8703090362d44501e4722b272a72ed7ada1
parent 320336 f4577ed221e40d1b1eb06ff7c741d98a22fd9e1c
child 320381 6bbf20decf8b7b6bc7026c6b32458e061bb8cf1d
push id9188
push userxquan@mozilla.com
push dateMon, 11 Jan 2016 07:07:22 +0000
bugs1189622
milestone46.0a1
Bug 1189622 part 1 - Ensure the in-fullscreen-change flag is set before calling the second phase.
dom/base/nsGlobalWindow.cpp
--- a/dom/base/nsGlobalWindow.cpp
+++ b/dom/base/nsGlobalWindow.cpp
@@ -6089,16 +6089,23 @@ nsGlobalWindow::SetFullscreenInternal(Fu
     if (MakeWidgetFullscreen(this, aHMD, aReason, aFullScreen)) {
       // The rest of code for switching fullscreen is in nsGlobalWindow::
       // FinishFullscreenChange() which will be called after sizemodechange
       // event is dispatched.
       return NS_OK;
     }
   }
 
+  // If we didn't setup the widget, we may need to manually set this
+  // flag, or the assertion in FinishFullscreenChange is violated.
+  if (nsCOMPtr<nsIPresShell> presShell = mDocShell->GetPresShell()) {
+    if (!presShell->IsInFullscreenChange()) {
+      presShell->SetIsInFullscreenChange(true);
+    }
+  }
   FinishFullscreenChange(aFullScreen);
   return NS_OK;
 }
 
 void
 nsGlobalWindow::SetWidgetFullscreen(FullscreenReason aReason, bool aIsFullscreen,
                                     nsIWidget* aWidget, nsIScreen* aScreen)
 {