diff --git a/content/base/src/nsDocument.cpp b/content/base/src/nsDocument.cpp index 8e34b3f1990..eabfa594166 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; }