Backed out changeset c522095c6db2 (bug 1629953) for causing failures in browser_aboutStopReload.js

CLOSED TREE
This commit is contained in:
Mihai Alexandru Michis 2020-04-15 01:57:31 +03:00
Родитель f6ffe5ade9
Коммит 72126bcffd
2 изменённых файлов: 37 добавлений и 5 удалений

Просмотреть файл

@ -200,6 +200,8 @@ pref("browser.fixup.domainwhitelist.localhost", true);
pref("general.autoScroll", true);
#endif
pref("browser.stopReloadAnimation.enabled", true);
// UI density of the browser chrome. This mostly affects toolbarbutton
// and urlbar spacing. The possible values are 0=normal, 1=compact, 2=touch.
pref("browser.uidensity", 0);

Просмотреть файл

@ -2251,6 +2251,10 @@ var gBrowserInit = {
gTabsPanel.init();
});
scheduleIdleTask(() => {
CombinedStopReload.startAnimationPrefMonitoring();
});
scheduleIdleTask(() => {
// setup simple gestures support
gGestureSupport.init(true);
@ -5625,9 +5629,9 @@ var CombinedStopReload = {
this.stopReloadContainer = this.reload.parentNode;
this.timeWhenSwitchedToStop = 0;
this.stopReloadContainer.addEventListener("animationend", this);
this.stopReloadContainer.addEventListener("animationcancel", this);
if (this._shouldStartPrefMonitoring) {
this.startAnimationPrefMonitoring();
}
return true;
},
@ -5638,6 +5642,7 @@ var CombinedStopReload = {
return;
}
Services.prefs.removeObserver("toolkit.cosmeticAnimations.enabled", this);
this._cancelTransition();
this.stop.removeEventListener("click", this);
this.stopReloadContainer.removeEventListener("animationend", this);
@ -5669,6 +5674,31 @@ var CombinedStopReload = {
}
},
observe(subject, topic, data) {
if (topic == "nsPref:changed") {
this.animate = Services.prefs.getBoolPref(
"toolkit.cosmeticAnimations.enabled"
);
}
},
startAnimationPrefMonitoring() {
// CombinedStopReload may have been uninitialized before the idleCallback is executed.
if (this._destroyed) {
return;
}
if (!this.ensureInitialized()) {
this._shouldStartPrefMonitoring = true;
return;
}
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);
this.stopReloadContainer.addEventListener("animationcancel", this);
},
onTabSwitch() {
// Reset the time in the event of a tabswitch since the stored time
// would have been associated with the previous tab, so the animation will
@ -5697,7 +5727,7 @@ var CombinedStopReload = {
aWebProgress.isLoadingDocument &&
!gBrowser.tabAnimationsInProgress &&
this.stopReloadContainer.closest("#nav-bar-customization-target") &&
window.matchMedia("(prefers-reduced-motion: no-preference)").matches;
this.animate;
this._cancelTransition();
if (shouldAnimate) {
@ -5721,7 +5751,7 @@ var CombinedStopReload = {
!gBrowser.tabAnimationsInProgress &&
this._loadTimeExceedsMinimumForAnimation() &&
this.stopReloadContainer.closest("#nav-bar-customization-target") &&
window.matchMedia("(prefers-reduced-motion: no-preference)").matches;
this.animate;
if (shouldAnimate) {
BrowserUtils.setToolbarButtonHeightProperty(this.stopReloadContainer);