Bug 821879 - don't initialize Telemetry if we can't send any data in; r=vdjeric
authorNathan Froyd <froydnj@mozilla.com>
Fri, 14 Dec 2012 17:03:31 -0500
changeset 126554 84d3b622b3da8db3078d65e069a6cb78165e24c9
parent 126553 e1e4862d5e1d54a474ed30837966e49dc6b91d05
child 126555 8f3b007280f45284042cbad2eae5864e162142f6
push id2151
push userlsblakk@mozilla.com
push dateTue, 19 Feb 2013 18:06:57 +0000
treeherdermozilla-beta@4952e88741ec [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersvdjeric
bugs821879
milestone20.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 821879 - don't initialize Telemetry if we can't send any data in; r=vdjeric
toolkit/components/telemetry/TelemetryPing.js
--- a/toolkit/components/telemetry/TelemetryPing.js
+++ b/toolkit/components/telemetry/TelemetryPing.js
@@ -712,16 +712,25 @@ TelemetryPing.prototype = {
       this._isIdleObserver = false;
     }
   },
 
   /**
    * Initializes telemetry within a timer. If there is no PREF_SERVER set, don't turn on telemetry.
    */
   setup: function setup() {
+#ifdef MOZILLA_OFFICIAL
+    if (!Telemetry.canSend) {
+      // 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.canRecord = false;
+      return;
+    }
+#endif
     let enabled = false; 
     try {
       enabled = Services.prefs.getBoolPref(PREF_ENABLED);
       this._server = Services.prefs.getCharPref(PREF_SERVER);
     } catch (e) {
       // Prerequesite prefs aren't set
     }
     if (!enabled) {