diff --git a/content/base/src/nsDocument.cpp b/content/base/src/nsDocument.cpp index 41a080f37f1..86a83112739 100644 --- a/content/base/src/nsDocument.cpp +++ b/content/base/src/nsDocument.cpp @@ -8907,16 +8907,9 @@ nsDocument::RequestFullScreen(Element* aElement, bool aWasCallerChrome) // Remember this is the requesting full-screen document. sFullScreenDoc = do_GetWeakReference(static_cast(this)); - // Make the window full-screen. Note we must make the state changes above - // before making the window full-screen, as then the document reports as - // being in full-screen mode when the chrome "fullscreen" event fires, - // enabling chrome to distinguish between browser and dom full-screen - // modes. Also note that nsGlobalWindow::SetFullScreen() (which - // SetWindowFullScreen() calls) proxies to the root window in its hierarchy, - // and does not operate on the a per-nsIDOMWindow basis. - SetWindowFullScreen(this, true); - #ifdef DEBUG + // Note assertions must run before SetWindowFullScreen() as that does + // synchronous event dispatch which can run script which exits full-screen! NS_ASSERTION(GetFullScreenElement() == aElement, "Full-screen element should be the requested element!"); NS_ASSERTION(IsFullScreenDoc(), "Should be full-screen doc"); @@ -8926,6 +8919,15 @@ nsDocument::RequestFullScreen(Element* aElement, bool aWasCallerChrome) NS_ASSERTION(c->AsElement() == aElement, "GetMozFullScreenElement should match GetFullScreenElement()"); #endif + + // Make the window full-screen. Note we must make the state changes above + // before making the window full-screen, as then the document reports as + // being in full-screen mode when the chrome "fullscreen" event fires, + // enabling chrome to distinguish between browser and dom full-screen + // modes. Also note that nsGlobalWindow::SetFullScreen() (which + // SetWindowFullScreen() calls) proxies to the root window in its hierarchy, + // and does not operate on the a per-nsIDOMWindow basis. + SetWindowFullScreen(this, true); } NS_IMETHODIMP