Bug 948268 - Remove privilege check from MozCancelFullScreen() to comply with the spec. r=cpearce, f=bz,smaug
authorMasatoshi Kimura <VYV03354@nifty.ne.jp>
Sat, 14 Dec 2013 13:22:47 +0900
changeset 160497 be5f5ca171f029571171f2da960c910d3808ebd3
parent 160496 00db24c44565df7e3c4b0cd0ddca67051d78f8e5
child 160498 8bb981d3522bb4919f28f4aa74b0796741cd3914
push id37605
push userVYV03354@nifty.ne.jp
push dateSat, 14 Dec 2013 04:23:11 +0000
treeherdermozilla-inbound@8bb981d3522b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerscpearce
bugs948268
milestone29.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 948268 - Remove privilege check from MozCancelFullScreen() to comply with the spec. r=cpearce, f=bz,smaug
content/base/src/nsDocument.cpp
content/html/content/test/file_fullscreen-api.html
--- a/content/base/src/nsDocument.cpp
+++ b/content/base/src/nsDocument.cpp
@@ -9709,23 +9709,17 @@ nsDocument::MozCancelFullScreen()
 {
   nsIDocument::MozCancelFullScreen();
   return NS_OK;
 }
 
 void
 nsIDocument::MozCancelFullScreen()
 {
-  // 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();
 }
 
 // Runnable to set window full-screen mode. Used as a script runner
 // to ensure we only call nsGlobalWindow::SetFullScreen() when it's safe to
 // run script. nsGlobalWindow::SetFullScreen() dispatches a synchronous event
 // (handled in chome code) which is unsafe to run if this is called in
 // Element::UnbindFromTree().
 class nsSetWindowFullScreen : public nsRunnable {
--- a/content/html/content/test/file_fullscreen-api.html
+++ b/content/html/content/test/file_fullscreen-api.html
@@ -185,24 +185,22 @@ function error2(event) {
   addFullscreenChangeContinuation("enter", enter5);
   sendMouseClick(button);
 }
 
 function enter5(event) {
   ok(document.mozFullScreen, "Moved to full-screen after mouse click");
   addFullscreenChangeContinuation("exit", exit5);
   document.mozCancelFullScreen();
-  ok(document.mozFullScreen, "Should still be in full-screen mode, because calling context isn't trusted.");
-  setRequireTrustedContext(false);
-  document.mozCancelFullScreen();
   ok(!document.mozFullScreen, "Should have left full-screen mode.");
 }
 
 function exit5(event) {
   ok(!document.mozFullScreen, "Should have left full-screen mode (last time).");
+  setRequireTrustedContext(false);
 
   SpecialPowers.setBoolPref("full-screen-api.enabled", false);
   is(document.mozFullScreenEnabled, false, "document.mozFullScreenEnabled should be false if full-screen-api.enabled is false");
 
   addFullscreenErrorContinuation(error3);
   fullScreenElement().mozRequestFullScreen();
 }