Bug 1386255 - Switch the stop/reload button if the about: URL loaded is not top-level. r=Felipe
authorJared Wein <jwein@mozilla.com>
Wed, 02 Aug 2017 11:11:35 -0400
changeset 372431 d9420078ea8c909bd7c5854560e56c70411cb34b
parent 372430 a84cfe7de52c476bb5219ebffc3ed6d341dcb016
child 372432 1c99ecb8ddea376ad3f3ca09322cdede6b17501a
push id47855
push userjwein@mozilla.com
push dateWed, 02 Aug 2017 22:35:26 +0000
treeherderautoland@d9420078ea8c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersFelipe
bugs1386255
milestone56.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 1386255 - Switch the stop/reload button if the about: URL loaded is not top-level. r=Felipe MozReview-Commit-ID: Ieet9wNQf9o
browser/base/content/browser.js
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -5043,18 +5043,19 @@ var CombinedStopReload = {
       this.animate = Services.prefs.getBoolPref("toolkit.cosmeticAnimations.enabled") &&
                      Services.prefs.getBoolPref("browser.stopReloadAnimation.enabled");
       Services.prefs.addObserver("toolkit.cosmeticAnimations.enabled", this);
       this.stopReloadContainer.addEventListener("animationend", this);
     });
   },
 
   switchToStop(aRequest, aWebProgress) {
-    if (!this._initialized || !this._shouldSwitch(aRequest))
+    if (!this._initialized || !this._shouldSwitch(aRequest, aWebProgress)) {
       return;
+    }
 
     let shouldAnimate = AppConstants.MOZ_PHOTON_ANIMATIONS &&
                         aRequest instanceof Ci.nsIRequest &&
                         aWebProgress.isTopLevel &&
                         aWebProgress.isLoadingDocument &&
                         this.animate;
 
     this._cancelTransition();
@@ -5063,19 +5064,20 @@ var CombinedStopReload = {
       this.stopReloadContainer.setAttribute("animate", "true");
     } else {
       this.stopReloadContainer.removeAttribute("animate");
     }
     this.reload.setAttribute("displaystop", "true");
   },
 
   switchToReload(aRequest, aWebProgress) {
-    if (!this._initialized || !this._shouldSwitch(aRequest) ||
-        !this.reload.hasAttribute("displaystop"))
+    if (!this._initialized || !this._shouldSwitch(aRequest, aWebProgress) ||
+        !this.reload.hasAttribute("displaystop")) {
       return;
+    }
 
     let shouldAnimate = AppConstants.MOZ_PHOTON_ANIMATIONS &&
                         aRequest instanceof Ci.nsIRequest &&
                         aWebProgress.isTopLevel &&
                         !aWebProgress.isLoadingDocument &&
                         this.animate;
 
     if (shouldAnimate) {
@@ -5103,25 +5105,25 @@ var CombinedStopReload = {
     this.reload.disabled = true;
     this._timer = setTimeout(function(self) {
       self._timer = 0;
       self.reload.disabled = XULBrowserWindow.reloadCommand
                                              .getAttribute("disabled") == "true";
     }, 650, this);
   },
 
-  _shouldSwitch(aRequest) {
-    if (!aRequest ||
-        !aRequest.originalURI ||
-        aRequest.originalURI.spec.startsWith("about:reader"))
-      return true;
-
-    if (aRequest.originalURI.schemeIs("chrome") ||
-        aRequest.originalURI.schemeIs("about"))
+  _shouldSwitch(aRequest, aWebProgress) {
+    if (aRequest &&
+        aRequest.originalURI &&
+        (aRequest.originalURI.schemeIs("chrome") ||
+         (aRequest.originalURI.schemeIs("about") &&
+          aWebProgress.isTopLevel &&
+          !aRequest.originalURI.spec.startsWith("about:reader")))) {
       return false;
+    }
 
     return true;
   },
 
   _cancelTransition() {
     if (this._timer) {
       clearTimeout(this._timer);
       this._timer = 0;