Bug 1473631: Part 15 - Use a single pref observer for all telemetry environment preferences. r=gfritzsche

MozReview-Commit-ID: dGJDjUP4Vm

--HG--
extra : rebase_source : d7e801b2d5b3b0e1b390a78c835e445eda1d9ac6
extra : amend_source : 342b24fec8ee3cea9677080f588593405b233734
This commit is contained in:
Kris Maglione 2018-07-05 15:26:37 -07:00
Родитель 41c3c1071d
Коммит 8cfe473f10
1 изменённых файлов: 4 добавлений и 11 удалений

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

@ -1124,11 +1124,7 @@ EnvironmentCache.prototype = {
_startWatchingPrefs() {
this._log.trace("_startWatchingPrefs - " + this._watchedPrefs);
for (let [pref, options] of this._watchedPrefs) {
if (!("requiresRestart" in options) || !options.requiresRestart) {
Services.prefs.addObserver(pref, this, true);
}
}
Services.prefs.addObserver("", this, true);
},
_onPrefChanged(aData) {
@ -1144,11 +1140,7 @@ EnvironmentCache.prototype = {
_stopWatchingPrefs() {
this._log.trace("_stopWatchingPrefs");
for (let [pref, options] of this._watchedPrefs) {
if (!("requiresRestart" in options) || !options.requiresRestart) {
Services.prefs.removeObserver(pref, this);
}
}
Services.prefs.removeObserver("", this);
},
_addObservers() {
@ -1220,7 +1212,8 @@ EnvironmentCache.prototype = {
this._updateDefaultBrowser();
break;
case PREF_CHANGED_TOPIC:
if (this._watchedPrefs.has(aData)) {
let options = this._watchedPrefs.get(aData);
if (options && !options.requiresRestart) {
this._onPrefChanged(aData);
}
break;