Bug 1388145 - Move CombinedStopReload.startAnimationPrefMonitoring to per-window initialization tasks. r=jaws

MozReview-Commit-ID: EECjcWwN9yZ

--HG--
extra : rebase_source : 6de62459205284008ca8c43fd80d1d8b9acb3a41
This commit is contained in:
Felipe Gomes 2017-08-09 15:45:12 -03:00
Родитель a60bd21c16
Коммит 5130c05413
1 изменённых файлов: 12 добавлений и 21 удалений

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

@ -1748,6 +1748,10 @@ var gBrowserInit = {
gSync.init();
});
scheduleIdleTask(() => {
CombinedStopReload.startAnimationPrefMonitoring();
});
scheduleIdleTask(() => {
// setup simple gestures support
gGestureSupport.init(true);
@ -4974,14 +4978,6 @@ var CombinedStopReload = {
// Disable animations until the browser has fully loaded.
this.animate = false;
let startupInfo = Cc["@mozilla.org/toolkit/app-startup;1"]
.getService(Ci.nsIAppStartup)
.getStartupInfo();
if (startupInfo.sessionRestored) {
this.startAnimationPrefMonitoring();
} else {
Services.obs.addObserver(this, "sessionstore-windows-restored");
}
},
uninit() {
@ -5018,24 +5014,19 @@ var CombinedStopReload = {
},
observe(subject, topic, data) {
if (topic == "sessionstore-windows-restored") {
Services.obs.removeObserver(this, "sessionstore-windows-restored");
this.startAnimationPrefMonitoring();
} else if (topic == "nsPref:changed") {
if (topic == "nsPref:changed") {
this.animate = Services.prefs.getBoolPref("toolkit.cosmeticAnimations.enabled");
}
},
startAnimationPrefMonitoring() {
requestIdleCallback(() => {
// CombinedStopReload may have been uninitialized before the idleCallback is executed.
if (!this._initialized)
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);
});
// CombinedStopReload may have been uninitialized before the idleCallback is executed.
if (!this._initialized)
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);
},
onTabSwitch() {