From 13adbcf5c4a24f75dc3619a96748135e38df0697 Mon Sep 17 00:00:00 2001 From: "Carsten \"Tomcat\" Book" Date: Tue, 21 Oct 2014 14:38:09 +0200 Subject: [PATCH] Backed out changeset ed070348e5ec (bug 1064333) --- .../components/telemetry/TelemetryPing.jsm | 23 ++++--------------- .../tests/unit/test_TelemetryPing.js | 21 +++++------------ .../tests/unit/test_TelemetryPingBuildID.js | 6 ++--- 3 files changed, 13 insertions(+), 37 deletions(-) diff --git a/toolkit/components/telemetry/TelemetryPing.jsm b/toolkit/components/telemetry/TelemetryPing.jsm index 6a13db165ac3..68d2db28da68 100644 --- a/toolkit/components/telemetry/TelemetryPing.jsm +++ b/toolkit/components/telemetry/TelemetryPing.jsm @@ -32,7 +32,6 @@ const PREF_BRANCH = "toolkit.telemetry."; const PREF_SERVER = PREF_BRANCH + "server"; const PREF_ENABLED = PREF_BRANCH + "enabled"; const PREF_PREVIOUS_BUILDID = PREF_BRANCH + "previousBuildID"; -const PREF_FHR_UPLOAD_ENABLED = "datareporting.healthreport.uploadEnabled"; // Do not gather data more than once a minute const TELEMETRY_INTERVAL = 60000; @@ -704,6 +703,7 @@ let Impl = { UIMeasurements: UITelemetry.getUIMeasurements(), log: TelemetryLog.entries(), info: info, + clientID: this._clientID, }; if (Object.keys(this._slowSQLStartup).length != 0 && @@ -712,17 +712,6 @@ let Impl = { payloadObj.slowSQLStartup = this._slowSQLStartup; } - let fhrUploadEnabled = false; - try { - fhrUploadEnabled = Services.prefs.getBoolPref(PREF_FHR_UPLOAD_ENABLED); - } catch (e) { - // Pref not set. - } - - if (this._clientID && fhrUploadEnabled) { - payloadObj.clientID = this._clientID; - } - return payloadObj; }, @@ -970,12 +959,10 @@ let Impl = { this.attachObservers(); this.gatherMemory(); - if ("@mozilla.org/datareporting/service;1" in Cc) { - let drs = Cc["@mozilla.org/datareporting/service;1"] - .getService(Ci.nsISupports) - .wrappedJSObject; - this._clientID = yield drs.getClientID(); - } + let drs = Cc["@mozilla.org/datareporting/service;1"] + .getService(Ci.nsISupports) + .wrappedJSObject; + this._clientID = yield drs.getClientID(); Telemetry.asyncFetchTelemetryData(function () {}); delete this._timer; diff --git a/toolkit/components/telemetry/tests/unit/test_TelemetryPing.js b/toolkit/components/telemetry/tests/unit/test_TelemetryPing.js index 23a608545f78..30036a82beb9 100644 --- a/toolkit/components/telemetry/tests/unit/test_TelemetryPing.js +++ b/toolkit/components/telemetry/tests/unit/test_TelemetryPing.js @@ -43,7 +43,6 @@ let gNumberOfThreadsLaunched = 0; const PREF_BRANCH = "toolkit.telemetry."; const PREF_ENABLED = PREF_BRANCH + "enabled"; -const PREF_FHR_UPLOAD_ENABLED = "datareporting.healthreport.uploadEnabled"; const Telemetry = Cc["@mozilla.org/base/telemetry;1"].getService(Ci.nsITelemetry); @@ -172,12 +171,9 @@ function checkPayloadInfo(payload, reason) { do_check_true(payload.info.revision.startsWith("http")); } - if ("@mozilla.org/datareporting/service;1" in Cc && - Services.prefs.getBoolPref(PREF_FHR_UPLOAD_ENABLED)) { - do_check_true("clientID" in payload); - do_check_neq(payload.clientID, null); - do_check_eq(payload.clientID, gDataReportingClientID); - } + do_check_true("clientID" in payload); + do_check_neq(payload.clientID, null); + do_check_eq(payload.clientID, gDataReportingClientID); try { // If we've not got nsIGfxInfoDebug, then this will throw and stop us doing @@ -397,14 +393,11 @@ function run_test() { createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9.2"); Services.prefs.setBoolPref(PREF_ENABLED, true); - Services.prefs.setBoolPref(PREF_FHR_UPLOAD_ENABLED, true); // Send the needed startup notifications to the datareporting service // to ensure that it has been initialized. - if ("@mozilla.org/datareporting/service;1" in Cc) { - gDatareportingService.observe(null, "app-startup", null); - gDatareportingService.observe(null, "profile-after-change", null); - } + gDatareportingService.observe(null, "app-startup", null); + gDatareportingService.observe(null, "profile-after-change", null); // Make it look like we've previously failed to lock a profile a couple times. write_fake_failedprofilelocks_file(); @@ -455,9 +448,7 @@ function actualTest() { add_task(function* asyncSetup() { yield TelemetryPing.setup(); - if ("@mozilla.org/datareporting/service;1" in Cc) { - gDataReportingClientID = yield gDatareportingService.getClientID(); - } + gDataReportingClientID = yield gDatareportingService.getClientID(); }); // Ensure that not overwriting an existing file fails silently diff --git a/toolkit/components/telemetry/tests/unit/test_TelemetryPingBuildID.js b/toolkit/components/telemetry/tests/unit/test_TelemetryPingBuildID.js index 4e234d417042..f418f050c674 100644 --- a/toolkit/components/telemetry/tests/unit/test_TelemetryPingBuildID.js +++ b/toolkit/components/telemetry/tests/unit/test_TelemetryPingBuildID.js @@ -74,10 +74,8 @@ function run_test() { // Send the needed startup notifications to the datareporting service // to ensure that it has been initialized. - if ("@mozilla.org/datareporting/service;1" in Cc) { - gDatareportingService.observe(null, "app-startup", null); - gDatareportingService.observe(null, "profile-after-change", null); - } + gDatareportingService.observe(null, "app-startup", null); + gDatareportingService.observe(null, "profile-after-change", null); run_next_test(); }