Bug 691947 - Relax DOM full-screen API security constraints for requests coming from chrome. r=roc
authorChris Pearce <chris@pearce.org.nz>
Thu, 03 Nov 2011 19:37:38 +1300
changeset 79617 ab06f7315bd77f45ea924acd86b66fb9e55d9687
parent 79616 70be30dd20825d7353c7abc5e44631ece5538ffa
child 79618 c8b43b9b0398071a7fd7c19b762c51c71c925caa
push id3086
push usercpearce@mozilla.com
push dateThu, 03 Nov 2011 06:38:09 +0000
treeherdermozilla-inbound@ab06f7315bd7 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc
bugs691947
milestone10.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 691947 - Relax DOM full-screen API security constraints for requests coming from chrome. r=roc
content/base/src/nsContentUtils.cpp
content/base/src/nsDocument.cpp
--- a/content/base/src/nsContentUtils.cpp
+++ b/content/base/src/nsContentUtils.cpp
@@ -5808,17 +5808,19 @@ nsContentUtils::SetUpChannelOwner(nsIPri
 bool
 nsContentUtils::IsFullScreenApiEnabled()
 {
   return sIsFullScreenApiEnabled;
 }
 
 bool nsContentUtils::IsRequestFullScreenAllowed()
 {
-  return !sTrustedFullScreenOnly || nsEventStateManager::IsHandlingUserInput();
+  return !sTrustedFullScreenOnly ||
+         nsEventStateManager::IsHandlingUserInput() ||
+         IsCallerChrome();
 }
 
 bool
 nsContentUtils::IsFullScreenKeyInputRestricted()
 {
   return sFullScreenKeyInputRestricted;
 }
 
--- a/content/base/src/nsDocument.cpp
+++ b/content/base/src/nsDocument.cpp
@@ -8602,16 +8602,24 @@ nsDocument::GetMozFullScreen(bool *aFull
 }
 
 NS_IMETHODIMP
 nsDocument::GetMozFullScreenEnabled(bool *aFullScreen)
 {
   NS_ENSURE_ARG_POINTER(aFullScreen);
   *aFullScreen = false;
 
+  if (nsContentUtils::IsCallerChrome() &&
+      nsContentUtils::IsFullScreenApiEnabled()) {
+    // Chrome code can always use the full-screen API, provided it's not
+    // explicitly disabled.
+    *aFullScreen = true;
+    return NS_OK;
+  }
+
   if (!nsContentUtils::IsFullScreenApiEnabled() ||
       nsContentUtils::HasPluginWithUncontrolledEventDispatch(this) ||
       !IsVisible()) {
     return NS_OK;
   }
 
   // Ensure that all ancestor <iframe> elements have the mozallowfullscreen
   // boolean attribute set.