bug 1408433 - Remove toolkit.telemetry.enabled code from Experiments r=Dexter

MozReview-Commit-ID: 1Kz7G2oJWO6
This commit is contained in:
Chris H-C 2017-10-19 16:10:06 -04:00
Родитель 43db8f8428
Коммит bd45a385a1
1 изменённых файлов: 2 добавлений и 16 удалений

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

@ -26,8 +26,6 @@ XPCOMUtils.defineLazyModuleGetter(this, "TelemetryEnvironment",
"resource://gre/modules/TelemetryEnvironment.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "TelemetryLog",
"resource://gre/modules/TelemetryLog.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "TelemetryUtils",
"resource://gre/modules/TelemetryUtils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "CommonUtils",
"resource://services-common/utils.js");
@ -52,8 +50,6 @@ const PREF_LOGGING_DUMP = PREF_LOGGING + ".dump"; // experiments.logging
const PREF_MANIFEST_URI = "manifest.uri"; // experiments.logging.manifest.uri
const PREF_FORCE_SAMPLE = "force-sample-value"; // experiments.force-sample-value
const PREF_TELEMETRY_ENABLED = "toolkit.telemetry.enabled";
const URI_EXTENSION_STRINGS = "chrome://mozapps/locale/extensions/extensions.properties";
const CACHE_WRITE_RETRY_DELAY_SEC = 60 * 3;
@ -386,8 +382,6 @@ Experiments.Experiments.prototype = {
this.updateManifest();
} else if (data == PREF_BRANCH + PREF_ENABLED) {
this._toggleExperimentsEnabled(gPrefs.getBoolPref(PREF_ENABLED, false));
} else if (data == PREF_TELEMETRY_ENABLED) {
this._telemetryStatusChanged();
}
break;
}
@ -397,15 +391,13 @@ Experiments.Experiments.prototype = {
this._shutdown = false;
configureLogging();
gExperimentsEnabled = gPrefs.getBoolPref(PREF_ENABLED, false) && TelemetryUtils.isTelemetryEnabled;
gExperimentsEnabled = gPrefs.getBoolPref(PREF_ENABLED, false) && Services.telemetry.canRecordExtended;
this._log.trace("enabled=" + gExperimentsEnabled + ", " + this.enabled);
Services.prefs.addObserver(PREF_BRANCH + PREF_LOGGING, configureLogging);
Services.prefs.addObserver(PREF_BRANCH + PREF_MANIFEST_URI, this, true);
Services.prefs.addObserver(PREF_BRANCH + PREF_ENABLED, this, true);
Services.prefs.addObserver(PREF_TELEMETRY_ENABLED, this, true);
AddonManager.shutdown.addBlocker("Experiments.jsm shutdown",
this.uninit.bind(this),
this._getState.bind(this)
@ -453,8 +445,6 @@ Experiments.Experiments.prototype = {
Services.prefs.removeObserver(PREF_BRANCH + PREF_MANIFEST_URI, this);
Services.prefs.removeObserver(PREF_BRANCH + PREF_ENABLED, this);
Services.prefs.removeObserver(PREF_TELEMETRY_ENABLED, this);
if (this._timer) {
this._timer.clear();
}
@ -598,7 +588,7 @@ Experiments.Experiments.prototype = {
async _toggleExperimentsEnabled(enabled) {
this._log.trace("_toggleExperimentsEnabled(" + enabled + ")");
let wasEnabled = gExperimentsEnabled;
gExperimentsEnabled = enabled && TelemetryUtils.isTelemetryEnabled;
gExperimentsEnabled = enabled && Services.telemetry.canRecordExtended;
if (wasEnabled == gExperimentsEnabled) {
return;
@ -614,10 +604,6 @@ Experiments.Experiments.prototype = {
}
},
_telemetryStatusChanged() {
this._toggleExperimentsEnabled(gPrefs.getBoolPref(PREF_ENABLED, false));
},
/**
* Returns a promise that is resolved with an array of `ExperimentInfo` objects,
* which provide info on the currently and recently active experiments.