Bug 1169159 - Refactor the |enableTelemetryRecording| logic in TelemetryController.jsm. r=gfritzsche
authorAlessio Placitelli <alessio.placitelli@gmail.com>
Fri, 12 Jun 2015 06:09:00 +0200
changeset 279606 eeb332cac64eb52711f4f925fc1301a6e2aa9844
parent 279605 1a73250cd62d973a4f64ad1f39046998b0fc849c
child 279607 0b55b1cac565729dd794b071b4a1f16dc0f7623a
push id4932
push userjlund@mozilla.com
push dateMon, 10 Aug 2015 18:23:06 +0000
treeherdermozilla-beta@6dd5a4f5f745 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgfritzsche
bugs1169159
milestone41.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 1169159 - Refactor the |enableTelemetryRecording| logic in TelemetryController.jsm. r=gfritzsche
toolkit/components/telemetry/TelemetryController.jsm
--- a/toolkit/components/telemetry/TelemetryController.jsm
+++ b/toolkit/components/telemetry/TelemetryController.jsm
@@ -589,31 +589,30 @@ let Impl = {
    */
   enableTelemetryRecording: function enableTelemetryRecording() {
     const enabled = Preferences.get(PREF_ENABLED, false);
 
     // Enable base Telemetry recording, if needed.
     Telemetry.canRecordBase = enabled || IS_UNIFIED_TELEMETRY;
 
 #ifdef MOZILLA_OFFICIAL
-    if (!Telemetry.isOfficialTelemetry && !this._testMode) {
-      // We can't send data; no point in initializing observers etc.
-      // Only do this for official builds so that e.g. developer builds
-      // still enable Telemetry based on prefs.
-      Telemetry.canRecordExtended = false;
-      this._log.config("enableTelemetryRecording - Can't send data, disabling extended Telemetry recording.");
-    }
+    // Enable extended telemetry if:
+    //  * the telemetry preference is set and
+    //  * this is an official build or we are in test-mode
+    // We only do the latter check for official builds so that e.g. developer builds
+    // still enable Telemetry based on prefs.
+    Telemetry.canRecordExtended = enabled && (Telemetry.isOfficialTelemetry || this._testMode);
+#else
+    // Turn off extended telemetry recording if disabled by preferences or if base/telemetry
+    // telemetry recording is off.
+    Telemetry.canRecordExtended = enabled;
 #endif
 
-    if (!enabled || !Telemetry.canRecordBase) {
-      // Turn off extended telemetry recording if disabled by preferences or if base/telemetry
-      // telemetry recording is off.
-      Telemetry.canRecordExtended = false;
-      this._log.config("enableTelemetryRecording - Disabling extended Telemetry recording.");
-    }
+    this._log.config("enableTelemetryRecording - canRecordBase:" + Telemetry.canRecordBase +
+                     ", canRecordExtended: " + Telemetry.canRecordExtended);
 
     return Telemetry.canRecordBase;
   },
 
   /**
    * This triggers basic telemetry initialization and schedules a full initialized for later
    * for performance reasons.
    *