From 52afa94578ec882d08b0f10f355605bb44264890 Mon Sep 17 00:00:00 2001 From: Chris Pearce Date: Fri, 17 Aug 2012 12:47:48 +1200 Subject: [PATCH] Bug 781384 - Allow web apps to exit fullscreen outside of user generated event handlers. r=jlebar --- content/base/src/nsDocument.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/content/base/src/nsDocument.cpp b/content/base/src/nsDocument.cpp index 8e34b3f19901..eabfa5941667 100644 --- a/content/base/src/nsDocument.cpp +++ b/content/base/src/nsDocument.cpp @@ -8492,10 +8492,13 @@ DispatchFullScreenChange(nsIDocument* aTarget) NS_IMETHODIMP nsDocument::MozCancelFullScreen() { - if (!nsContentUtils::IsRequestFullScreenAllowed()) { - return NS_OK; + // Only perform fullscreen changes if we're running in a webapp + // same-origin to the web app, or if we're in a user generated event + // handler. + if (NodePrincipal()->GetAppStatus() >= nsIPrincipal::APP_STATUS_INSTALLED || + nsContentUtils::IsRequestFullScreenAllowed()) { + RestorePreviousFullScreenState(); } - RestorePreviousFullScreenState(); return NS_OK; }