Bug 1053413 part 1.1 - Rename Moz{Entered,Exited}DomFullscreen to MozDOMFullscreen:{Entered,Exited}. r=smaug
authorXidorn Quan <quanxunzhen@gmail.com>
Thu, 21 May 2015 09:52:26 +1200
changeset 244795 e2402e6bb721a49c2715e76444a21b5a8acb4971
parent 244794 4a335d85b27b75196b5f0a785073f69c4086bae0
child 244796 8f108ece50fabdd3afcfcbb098d4b31cd8210c8e
push id60038
push userxquan@mozilla.com
push dateWed, 20 May 2015 21:53:15 +0000
treeherdermozilla-inbound@49ffe4e6b4d2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs1053413
milestone41.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 1053413 part 1.1 - Rename Moz{Entered,Exited}DomFullscreen to MozDOMFullscreen:{Entered,Exited}. r=smaug
browser/base/content/browser-fullScreen.js
browser/base/content/tab-content.js
dom/base/nsDocument.cpp
dom/tests/mochitest/chrome/MozDomFullscreen_chrome.xul
--- a/browser/base/content/browser-fullScreen.js
+++ b/browser/base/content/browser-fullScreen.js
@@ -4,26 +4,26 @@
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 var FullScreen = {
   _XULNS: "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul",
 
   init: function() {
     // called when we go into full screen, even if initiated by a web page script
     window.addEventListener("fullscreen", this, true);
-    window.messageManager.addMessageListener("MozEnteredDomFullscreen", this);
-    window.messageManager.addMessageListener("MozExitedDomFullscreen", this);
+    window.messageManager.addMessageListener("DOMFullscreen:Entered", this);
+    window.messageManager.addMessageListener("DOMFullscreen:Exited", this);
 
     if (window.fullScreen)
       this.toggle();
   },
 
   uninit: function() {
-    window.messageManager.removeMessageListener("MozEnteredDomFullscreen", this);
-    window.messageManager.removeMessageListener("MozExitedDomFullscreen", this);
+    window.messageManager.removeMessageListener("DOMFullscreen:Entered", this);
+    window.messageManager.removeMessageListener("DOMFullscreen:Exited", this);
     this.cleanup();
   },
 
   toggle: function (event) {
     var enterFS = window.fullScreen;
 
     // We get the fullscreen event _before_ the window transitions into or out of FS mode.
     if (event && event.type == "fullscreen")
@@ -89,33 +89,33 @@ var FullScreen = {
         if (event.propertyName == "opacity")
           this.cancelWarning();
         break;
     }
   },
 
   receiveMessage: function(aMessage) {
     switch (aMessage.name) {
-      case "MozEnteredDomFullscreen": {
+      case "DOMFullscreen:Entered": {
         // If we're a multiprocess browser, then the request to enter
         // fullscreen did not bubble up to the root browser document -
         // it stopped at the root of the content document. That means
         // we have to kick off the switch to fullscreen here at the
         // operating system level in the parent process ourselves.
         let data = aMessage.data;
         let browser = aMessage.target;
         if (gMultiProcessBrowser && browser.getAttribute("remote") == "true") {
           let windowUtils = window.QueryInterface(Ci.nsIInterfaceRequestor)
                                   .getInterface(Ci.nsIDOMWindowUtils);
           windowUtils.remoteFrameFullscreenChanged(browser, data.origin);
         }
         this.enterDomFullscreen(browser, data.origin);
         break;
       }
-      case "MozExitedDomFullscreen": {
+      case "DOMFullscreen:Exited": {
         document.documentElement.removeAttribute("inDOMFullscreen");
         this.cleanupDomFullscreen();
         this.showNavToolbox();
         // If we are still in fullscreen mode, re-hide
         // the toolbox with animation.
         if (window.fullScreen) {
           this._shouldAnimate = true;
           this.hideNavToolbox();
--- a/browser/base/content/tab-content.js
+++ b/browser/base/content/tab-content.js
@@ -584,18 +584,18 @@ if (Services.appinfo.processType == Serv
 
 
 let DOMFullscreenHandler = {
   _fullscreenDoc: null,
 
   init: function() {
     addMessageListener("DOMFullscreen:Approved", this);
     addMessageListener("DOMFullscreen:CleanUp", this);
-    addEventListener("MozEnteredDomFullscreen", this);
-    addEventListener("MozExitedDomFullscreen", this);
+    addEventListener("MozDOMFullscreen:Entered", this);
+    addEventListener("MozDOMFullscreen:Exited", this);
   },
 
   receiveMessage: function(aMessage) {
     switch(aMessage.name) {
       case "DOMFullscreen:Approved": {
         if (this._fullscreenDoc) {
           Services.obs.notifyObservers(this._fullscreenDoc,
                                        "fullscreen-approved",
@@ -607,23 +607,23 @@ let DOMFullscreenHandler = {
         this._fullscreenDoc = null;
         break;
       }
     }
   },
 
   handleEvent: function(aEvent) {
     switch (aEvent.type) {
-      case "MozEnteredDomFullscreen": {
+      case "MozDOMFullscreen:Entered": {
         this._fullscreenDoc = aEvent.target;
-        sendAsyncMessage("MozEnteredDomFullscreen", {
+        sendAsyncMessage("DOMFullscreen:Entered", {
           origin: this._fullscreenDoc.nodePrincipal.origin,
         });
         break;
       }
-      case "MozExitedDomFullscreen": {
-        sendAsyncMessage("MozExitedDomFullscreen");
+      case "MozDOMFullscreen:Exited": {
+        sendAsyncMessage("DOMFullscreen:Exited");
         break;
       }
     }
   }
 };
 DOMFullscreenHandler.init();
--- a/dom/base/nsDocument.cpp
+++ b/dom/base/nsDocument.cpp
@@ -11214,21 +11214,23 @@ ExitFullscreenInDocTree(nsIDocument* aMa
   // document, as required by the spec.
   for (uint32_t i = 0; i < changed.Length(); ++i) {
     DispatchFullScreenChange(changed[changed.Length() - i - 1]);
   }
 
   NS_ASSERTION(!root->IsFullScreenDoc(),
     "Fullscreen root should no longer be a fullscreen doc...");
 
-  // Dispatch MozExitedDomFullscreen to the last document in
+  // Dispatch MozDOMFullscreen:Exited to the last document in
   // the list since we want this event to follow the same path
-  // MozEnteredDomFullscreen dispatched.
-  nsRefPtr<AsyncEventDispatcher> asyncDispatcher = new AsyncEventDispatcher(
-    changed.LastElement(), NS_LITERAL_STRING("MozExitedDomFullscreen"), true, true);
+  // MozDOMFullscreen:Entered dispatched.
+  nsRefPtr<AsyncEventDispatcher> asyncDispatcher =
+    new AsyncEventDispatcher(changed.LastElement(),
+                             NS_LITERAL_STRING("MozDOMFullscreen:Exited"),
+                             true, true);
   asyncDispatcher->PostDOMEvent();
   // Move the top-level window out of fullscreen mode.
   SetWindowFullScreen(root, false);
 }
 
 /* static */
 void
 nsDocument::ExitFullscreen(nsIDocument* aDoc)
@@ -11345,17 +11347,17 @@ nsDocument::RestorePreviousFullScreenSta
         // a fullscreen element in a parent document. If this document isn't
         // approved for fullscreen, or if it's cross origin, dispatch an
         // event to chrome so it knows to show the authorization/warning UI.
         if (!nsContentUtils::HaveEqualPrincipals(fullScreenDoc, doc) ||
             (!nsContentUtils::IsSitePermAllow(doc->NodePrincipal(), "fullscreen") &&
              !static_cast<nsDocument*>(doc)->mIsApprovedForFullscreen)) {
           nsRefPtr<AsyncEventDispatcher> asyncDispatcher =
             new AsyncEventDispatcher(doc,
-                  NS_LITERAL_STRING("MozEnteredDomFullscreen"),
+                  NS_LITERAL_STRING("MozDOMFullscreen:Entered"),
                   true,
                   true);
           asyncDispatcher->PostDOMEvent();
         }
       }
 
       if (!nsContentUtils::HaveEqualPrincipals(doc, fullScreenDoc)) {
         // The origin which is fullscreen changed. Send a notification to
@@ -11373,17 +11375,17 @@ nsDocument::RestorePreviousFullScreenSta
   }
 
   if (doc == nullptr) {
     // We moved all documents in this doctree out of fullscreen mode,
     // move the top-level window out of fullscreen mode.
     NS_ASSERTION(!nsContentUtils::GetRootDocument(this)->IsFullScreenDoc(),
                  "Should have cleared all docs' stacks");
     nsRefPtr<AsyncEventDispatcher> asyncDispatcher = new AsyncEventDispatcher(
-      this, NS_LITERAL_STRING("MozExitedDomFullscreen"), true, true);
+      this, NS_LITERAL_STRING("MozDOMFullscreen:Exited"), true, true);
     asyncDispatcher->PostDOMEvent();
     SetWindowFullScreen(this, false);
   }
 }
 
 bool
 nsDocument::IsFullScreenDoc()
 {
@@ -11823,17 +11825,17 @@ nsDocument::RequestFullScreen(Element* a
   // an event so that chrome knows to pop up a warning/approval UI.
   // Note previousFullscreenDoc=nullptr upon first entry, so we always
   // take this path on the first time we enter fullscreen in a fullscreen
   // session.
   if (!mIsApprovedForFullscreen ||
       !nsContentUtils::HaveEqualPrincipals(previousFullscreenDoc, this)) {
     nsRefPtr<AsyncEventDispatcher> asyncDispatcher =
       new AsyncEventDispatcher(this,
-                               NS_LITERAL_STRING("MozEnteredDomFullscreen"),
+                               NS_LITERAL_STRING("MozDOMFullscreen:Entered"),
                                true,
                                true);
     asyncDispatcher->PostDOMEvent();
   }
 
 #ifdef DEBUG
   // Note assertions must run before SetWindowFullScreen() as that does
   // synchronous event dispatch which can run script which exits full-screen!
--- a/dom/tests/mochitest/chrome/MozDomFullscreen_chrome.xul
+++ b/dom/tests/mochitest/chrome/MozDomFullscreen_chrome.xul
@@ -1,26 +1,26 @@
 <?xml version="1.0"?>
 <?xml-stylesheet href="chrome://global/skin" type="text/css"?>
 <?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
 <!--
-  Test that "MozEnteredFullscreen" is dispatched to chrome on documents that enter fullscreen.
+  Test that "MozDOMFullscreen:*" events are dispatched to chrome on documents that use DOM fullscreen.
 
   Test Description:
   
   This chrome window has a browser. The browser's contentDocument (the "outer document")
   in turn has an iframe (the "inner document").
   
-  We request fullscreen in the outer document, and check that MozEnteredDomFullscreen is
+  We request fullscreen in the outer document, and check that MozDOMFullscreen:Entered is
   dispatched to chrome, targeted at the outer document.
   
-  Then we request fullscreen in the inner document, and check that MozEnteredDomFullscreen
+  Then we request fullscreen in the inner document, and check that MozDOMFullscreen:Entered
   is dispatched to chrome, targeted at the inner document.
   
-  Then we cancel fullscreen in the inner document, and check that MozEnteredDomFullscreen is
+  Then we cancel fullscreen in the inner document, and check that MozDOMFullscreen:Entered is
   dispatched again to chrome, targeted at the outer document. This still happens, since the
   outer document's domain was never approved for fullscreen.
 -->
 <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" onload="start();">
 
 <script type="application/javascript" src="chrome://mochikit/content/chrome-harness.js"></script>
 <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>
 <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>      
@@ -34,62 +34,61 @@ function is(a, b, msg) {
   window.opener.wrappedJSObject.is(a, b, msg);
 }
 
 var gBrowser = null;
 var gOuterDoc = null;
 var gInnerDoc = null;
 
 function firstEntry(event) {
-  is(event.target, gOuterDoc, "First MozEnteredDomFullscreen should be targeted at outer doc");
-  window.removeEventListener("MozEnteredDomFullscreen", firstEntry, false);
+  is(event.target, gOuterDoc, "First MozDOMFullscreen:Entered should be targeted at outer doc");
+  window.removeEventListener("MozDOMFullscreen:Entered", firstEntry, false);
   ok(gOuterDoc.mozFullScreenElement != null, "Outer doc should be in fullscreen");
   gInnerDoc = gOuterDoc.getElementById("innerFrame").contentDocument;
-  window.addEventListener("MozEnteredDomFullscreen", secondEntry, false);
+  window.addEventListener("MozDOMFullscreen:Entered", secondEntry, false);
   gInnerDoc.defaultView.focus();
   gInnerDoc.body.mozRequestFullScreen();
 }
 
 function secondEntry(event) {
-  is(event.target, gInnerDoc, "Second MozEnteredDomFullscreen should be targeted at inner doc");
+  is(event.target, gInnerDoc, "Second MozDOMFullscreen:Entered should be targeted at inner doc");
   ok(gInnerDoc.mozFullScreenElement != null, "Inner doc should be in fullscreen");
-  window.removeEventListener("MozEnteredDomFullscreen", secondEntry, false);
-  window.addEventListener("MozEnteredDomFullscreen", thirdEntry, false);
+  window.removeEventListener("MozDOMFullscreen:Entered", secondEntry, false);
+  window.addEventListener("MozDOMFullscreen:Entered", thirdEntry, false);
   gInnerDoc.mozCancelFullScreen();
 }
 
 function thirdEntry(event) {
-  is(event.target, gOuterDoc, "Third MozEnteredDomFullscreen should be targeted at outer doc");
+  is(event.target, gOuterDoc, "Third MozDOMFullscreen:Entered should be targeted at outer doc");
   ok(gOuterDoc.mozFullScreenElement != null, "Outer doc return to fullscreen after cancel fullscreen in inner doc");
-  window.removeEventListener("MozEnteredDomFullscreen", thirdEntry, false);
-  window.removeEventListener("MozExitedDomFullscreen", earlyExit, false);
-  window.addEventListener("MozExitedDomFullscreen", lastExit, false);
+  window.removeEventListener("MozDOMFullscreen:Entered", thirdEntry, false);
+  window.removeEventListener("MozDOMFullscreen:Exited", earlyExit, false);
+  window.addEventListener("MozDOMFullscreen:Exited", lastExit, false);
   gOuterDoc.mozCancelFullScreen();
 }
 
 function earlyExit(event) {
-  ok(false, "MozExitedDomFullscreen should only be triggered after cancel all fullscreen");
+  ok(false, "MozDOMFullscreen:Exited should only be triggered after cancel all fullscreen");
 }
 
 function lastExit(event) {
-  is(event.target, gOuterDoc, "MozExitedDomFullscreen should be targeted at the last exited doc");
+  is(event.target, gOuterDoc, "MozDOMFullscreen:Exited should be targeted at the last exited doc");
   ok(gOuterDoc.mozFullScreenElement == null, "Fullscreen should have been fully exited");
   window.opener.wrappedJSObject.done();
 }
 
 function start() {
   SimpleTest.waitForFocus(
     function() {
       gBrowser = document.getElementById("browser");
       gOuterDoc = gBrowser.contentDocument;
       gBrowser.contentWindow.focus();
-      window.addEventListener("MozEnteredDomFullscreen", firstEntry, false);
-      window.addEventListener("MozExitedDomFullscreen", earlyExit, false);
+      window.addEventListener("MozDOMFullscreen:Entered", firstEntry, false);
+      window.addEventListener("MozDOMFullscreen:Exited", earlyExit, false);
       gOuterDoc.body.mozRequestFullScreen();
     });
 }
 
 ]]>
 </script>
-<!-- chrome://mochitests/content/chrome/dom/tests/mochitest/chrome/test_MozEnteredDomFullscreen_event.xul -->
 <browser type="content" id="browser" width="400" height="400" src="http://mochi.test:8888/tests/dom/tests/mochitest/general/file_MozDomFullscreen.html"/>
 
 </window>