Bug 1178456 - Experiments service shouldn't use FHR prefs. r=gfritzsche
authorAlessio Placitelli <alessio.placitelli@gmail.com>
Wed, 01 Jul 2015 05:46:00 +0200
changeset 251090 b9b256c42a62ac7e23fbd421f9a1f6ee6a29e4ac
parent 250984 2fc104758bb58cf72e1793b1a70c0636b8e97e0e
child 251091 a11965c0a317c4895facc0a69ec0ebcfbed7fccc
push id61766
push usercbook@mozilla.com
push dateThu, 02 Jul 2015 13:47:40 +0000
treeherdermozilla-inbound@8ee689f2899a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgfritzsche
bugs1178456
milestone42.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1178456 - Experiments service shouldn't use FHR prefs. r=gfritzsche
browser/experiments/ExperimentsService.js
--- a/browser/experiments/ExperimentsService.js
+++ b/browser/experiments/ExperimentsService.js
@@ -16,28 +16,35 @@ XPCOMUtils.defineLazyModuleGetter(this, 
                                   "resource://gre/modules/osfile.jsm");
 XPCOMUtils.defineLazyModuleGetter(this, "CommonUtils",
                                   "resource://services-common/utils.js");
 
 const PREF_EXPERIMENTS_ENABLED  = "experiments.enabled";
 const PREF_ACTIVE_EXPERIMENT    = "experiments.activeExperiment"; // whether we have an active experiment
 const PREF_HEALTHREPORT_ENABLED = "datareporting.healthreport.service.enabled";
 const PREF_TELEMETRY_ENABLED    = "toolkit.telemetry.enabled";
+const PREF_TELEMETRY_UNIFIED    = "toolkit.telemetry.unified";
 const DELAY_INIT_MS             = 30 * 1000;
 
+// Whether the FHR/Telemetry unification features are enabled.
+// Changing this pref requires a restart.
+const IS_UNIFIED_TELEMETRY = Preferences.get(PREF_TELEMETRY_UNIFIED, false);
+
 XPCOMUtils.defineLazyGetter(
   this, "gPrefs", () => {
     return new Preferences();
   });
 
 XPCOMUtils.defineLazyGetter(
   this, "gExperimentsEnabled", () => {
+    // We can enable experiments if either unified Telemetry or FHR is on, and the user
+    // has opted into Telemetry.
     return gPrefs.get(PREF_EXPERIMENTS_ENABLED, false) &&
-           gPrefs.get(PREF_TELEMETRY_ENABLED, false) &&
-           gPrefs.get(PREF_HEALTHREPORT_ENABLED, false);
+           (gPrefs.get(PREF_HEALTHREPORT_ENABLED, false) || IS_UNIFIED_TELEMETRY) &&
+           gPrefs.get(PREF_TELEMETRY_ENABLED, false);
   });
 
 XPCOMUtils.defineLazyGetter(
   this, "gActiveExperiment", () => {
     return gPrefs.get(PREF_ACTIVE_EXPERIMENT);
   });
 
 function ExperimentsService() {