Bug 752294 - Handle failure to enter fullscreen mode because window is invisible. r=bgirard a=lsblakk
authorSteven Michaud <smichaud@pobox.com>
Fri, 22 Jun 2012 18:55:50 -0500
changeset 98228 6d28ccd8dde5b46b192f2feeab7c8b1929c5607b
parent 98227 b5369413635154d39dfe3ad3031326f22b041a76
child 98229 43e03ed8caef600168916826bf805f6f33ad5be8
push id1569
push usersmichaud@pobox.com
push dateFri, 22 Jun 2012 23:56:19 +0000
treeherdermozilla-aurora@6d28ccd8dde5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbgirard, lsblakk
bugs752294
milestone15.0a2
Bug 752294 - Handle failure to enter fullscreen mode because window is invisible. r=bgirard a=lsblakk
widget/cocoa/nsCocoaWindow.mm
--- a/widget/cocoa/nsCocoaWindow.mm
+++ b/widget/cocoa/nsCocoaWindow.mm
@@ -1208,16 +1208,26 @@ NS_METHOD nsCocoaWindow::MakeFullScreen(
   }
 
   // We will call into MakeFullScreen redundantly when entering/exiting
   // fullscreen mode via OS X controls. When that happens we should just handle
   // it gracefully - no need to ASSERT.
   if (mFullScreen == aFullScreen) {
     return NS_OK;
   }
+
+  // If we're using native fullscreen mode and our native window is invisible,
+  // our attempt to go into fullscreen mode will fail with an assertion in
+  // system code, without [WindowDelegate windowDidFailToEnterFullScreen:]
+  // ever getting called.  To pre-empt this we bail here.  See bug 752294.
+  if (mUsesNativeFullScreen && aFullScreen && ![mWindow isVisible]) {
+    EnteredFullScreen(false);
+    return NS_OK;
+  }
+
   mInFullScreenTransition = true;
 
   if (mUsesNativeFullScreen) {
     // Calling toggleFullScreen will result in windowDid(FailTo)?(Enter|Exit)FullScreen
     // to be called from the OS. We will call EnteredFullScreen from those methods,
     // where mFullScreen will be set and a sizemode event will be dispatched.
     [mWindow toggleFullScreen:nil];
   } else {