Bug 1053413 part 1 - Some code style conversion on affected code. r=dao
authorXidorn Quan <quanxunzhen@gmail.com>
Thu, 21 May 2015 09:52:26 +1200
changeset 244794 4a335d85b27b75196b5f0a785073f69c4086bae0
parent 244793 8f57a2e8384b29139e14685e9329f69edf1c6e91
child 244795 e2402e6bb721a49c2715e76444a21b5a8acb4971
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)
reviewersdao
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 - Some code style conversion on affected code. r=dao
browser/base/content/browser-fullScreen.js
browser/base/content/tab-content.js
--- a/browser/base/content/browser-fullScreen.js
+++ b/browser/base/content/browser-fullScreen.js
@@ -88,39 +88,44 @@ var FullScreen = {
       case "transitionend":
         if (event.propertyName == "opacity")
           this.cancelWarning();
         break;
     }
   },
 
   receiveMessage: function(aMessage) {
-    if (aMessage.name == "MozEnteredDomFullscreen") {
-      // 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);
+    switch (aMessage.name) {
+      case "MozEnteredDomFullscreen": {
+        // 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;
       }
-      this.enterDomFullscreen(browser, data.origin);
-    } else if (aMessage.name == "MozExitedDomFullscreen") {
-      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();
+      case "MozExitedDomFullscreen": {
+        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();
+        }
+        break;
       }
     }
   },
 
   enterDomFullscreen : function(aBrowser, aOrigin) {
     if (!document.mozFullScreen)
       return;
 
--- a/browser/base/content/tab-content.js
+++ b/browser/base/content/tab-content.js
@@ -606,19 +606,24 @@ let DOMFullscreenHandler = {
       case "DOMFullscreen:CleanUp": {
         this._fullscreenDoc = null;
         break;
       }
     }
   },
 
   handleEvent: function(aEvent) {
-    if (aEvent.type == "MozEnteredDomFullscreen") {
-      this._fullscreenDoc = aEvent.target;
-      sendAsyncMessage("MozEnteredDomFullscreen", {
-        origin: this._fullscreenDoc.nodePrincipal.origin,
-      });
-    } else if (aEvent.type == "MozExitedDomFullscreen") {
-      sendAsyncMessage("MozExitedDomFullscreen");
+    switch (aEvent.type) {
+      case "MozEnteredDomFullscreen": {
+        this._fullscreenDoc = aEvent.target;
+        sendAsyncMessage("MozEnteredDomFullscreen", {
+          origin: this._fullscreenDoc.nodePrincipal.origin,
+        });
+        break;
+      }
+      case "MozExitedDomFullscreen": {
+        sendAsyncMessage("MozExitedDomFullscreen");
+        break;
+      }
     }
   }
 };
 DOMFullscreenHandler.init();