Bug 1386255 - Switch the stop/reload button if the about: URL loaded is not top-level. r?felipe
MozReview-Commit-ID: Ieet9wNQf9o
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -5041,18 +5041,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();
@@ -5061,19 +5062,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) {
@@ -5101,25 +5103,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;