Bug 1217282 - Experiments are enabled even when telemetry is disabled. r=gfritzsche

This commit is contained in:
Alessio Placitelli 2015-12-04 09:49:00 +01:00
parent 8ba7477936
commit 01a9c3f2af

View File

@ -30,6 +30,8 @@ XPCOMUtils.defineLazyModuleGetter(this, "TelemetryEnvironment",
"resource://gre/modules/TelemetryEnvironment.jsm"); "resource://gre/modules/TelemetryEnvironment.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "TelemetryLog", XPCOMUtils.defineLazyModuleGetter(this, "TelemetryLog",
"resource://gre/modules/TelemetryLog.jsm"); "resource://gre/modules/TelemetryLog.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "TelemetryUtils",
"resource://gre/modules/TelemetryUtils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "CommonUtils", XPCOMUtils.defineLazyModuleGetter(this, "CommonUtils",
"resource://services-common/utils.js"); "resource://services-common/utils.js");
XPCOMUtils.defineLazyModuleGetter(this, "Metrics", XPCOMUtils.defineLazyModuleGetter(this, "Metrics",
@ -160,10 +162,6 @@ function loadJSONAsync(file, options) {
}); });
} }
function telemetryEnabled() {
return gPrefsTelemetry.get(PREF_TELEMETRY_ENABLED, false);
}
// Returns a promise that is resolved with the AddonInstall for that URL. // Returns a promise that is resolved with the AddonInstall for that URL.
function addonInstallForURL(url, hash) { function addonInstallForURL(url, hash) {
let deferred = Promise.defer(); let deferred = Promise.defer();
@ -389,7 +387,7 @@ Experiments.Experiments.prototype = {
this._shutdown = false; this._shutdown = false;
configureLogging(); configureLogging();
gExperimentsEnabled = gPrefs.get(PREF_ENABLED, false); gExperimentsEnabled = gPrefs.get(PREF_ENABLED, false) && TelemetryUtils.isTelemetryEnabled;
this._log.trace("enabled=" + gExperimentsEnabled + ", " + this.enabled); this._log.trace("enabled=" + gExperimentsEnabled + ", " + this.enabled);
gPrefs.observe(PREF_LOGGING, configureLogging); gPrefs.observe(PREF_LOGGING, configureLogging);
@ -580,7 +578,7 @@ Experiments.Experiments.prototype = {
_toggleExperimentsEnabled: Task.async(function* (enabled) { _toggleExperimentsEnabled: Task.async(function* (enabled) {
this._log.trace("_toggleExperimentsEnabled(" + enabled + ")"); this._log.trace("_toggleExperimentsEnabled(" + enabled + ")");
let wasEnabled = gExperimentsEnabled; let wasEnabled = gExperimentsEnabled;
gExperimentsEnabled = enabled && telemetryEnabled(); gExperimentsEnabled = enabled && TelemetryUtils.isTelemetryEnabled;
if (wasEnabled == gExperimentsEnabled) { if (wasEnabled == gExperimentsEnabled) {
return; return;