Bug 781384 - Allow web apps to exit fullscreen outside of user generated event handlers. r=jlebar

This commit is contained in:
Chris Pearce 2012-08-17 12:47:48 +12:00
parent a7be937da8
commit 8ceac78a9d

View File

@ -8492,10 +8492,13 @@ DispatchFullScreenChange(nsIDocument* aTarget)
NS_IMETHODIMP NS_IMETHODIMP
nsDocument::MozCancelFullScreen() nsDocument::MozCancelFullScreen()
{ {
if (!nsContentUtils::IsRequestFullScreenAllowed()) { // Only perform fullscreen changes if we're running in a webapp
return NS_OK; // 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; return NS_OK;
} }