From d12eed31bb787969d320b35be8048a20fe77fabd Mon Sep 17 00:00:00 2001 From: "Brian R. Bondy" Date: Fri, 15 Jun 2012 11:59:35 -0400 Subject: [PATCH] Bug 763018 - Report telemetry data for if background updates are enabled. r=rstrong --- toolkit/components/telemetry/TelemetryHistograms.h | 1 + toolkit/mozapps/update/nsUpdateService.js | 11 +++++++---- toolkit/mozapps/update/test/shared.js | 2 +- toolkit/mozapps/update/test/unit/test_0030_general.js | 2 +- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/toolkit/components/telemetry/TelemetryHistograms.h b/toolkit/components/telemetry/TelemetryHistograms.h index 4cf95b19c45..97f51377b02 100644 --- a/toolkit/components/telemetry/TelemetryHistograms.h +++ b/toolkit/components/telemetry/TelemetryHistograms.h @@ -319,6 +319,7 @@ HISTOGRAM_BOOLEAN(UPDATER_UPDATES_AUTOMATIC, "Updater: Whether or not updates ar HISTOGRAM_BOOLEAN(UPDATER_SERVICE_ENABLED, "Updater: Whether or not the MozillaMaintenance service is enabled") HISTOGRAM(UPDATER_SERVICE_ERRORS, 1, 30, 31, LINEAR, "Updater: The number of MozillaMaintenance service errors that have occurred") HISTOGRAM_BOOLEAN(UPDATER_SERVICE_INSTALLED, "Updater: Whether or not the MozillaMaintenance service is installed") +HISTOGRAM_BOOLEAN(UPDATER_STAGE_ENABLED, "Updater: Whether or not staging updates are enabled") /** * Thunderbird-specific telemetry. diff --git a/toolkit/mozapps/update/nsUpdateService.js b/toolkit/mozapps/update/nsUpdateService.js index 4b7234c0332..775634329ac 100644 --- a/toolkit/mozapps/update/nsUpdateService.js +++ b/toolkit/mozapps/update/nsUpdateService.js @@ -42,7 +42,7 @@ const PREF_APP_UPDATE_POSTUPDATE = "app.update.postupdate"; const PREF_APP_UPDATE_PROMPTWAITTIME = "app.update.promptWaitTime"; const PREF_APP_UPDATE_SHOW_INSTALLED_UI = "app.update.showInstalledUI"; const PREF_APP_UPDATE_SILENT = "app.update.silent"; -const PREF_APP_UPDATE_BACKGROUND = "app.update.stage.enabled"; +const PREF_APP_UPDATE_STAGE_ENABLED = "app.update.stage.enabled"; const PREF_APP_UPDATE_URL = "app.update.url"; const PREF_APP_UPDATE_URL_DETAILS = "app.update.url.details"; const PREF_APP_UPDATE_URL_OVERRIDE = "app.update.url.override"; @@ -417,8 +417,8 @@ XPCOMUtils.defineLazyGetter(this, "gCanApplyUpdates", function aus_gCanApplyUpda XPCOMUtils.defineLazyGetter(this, "gCanStageUpdates", function aus_gCanStageUpdates() { // If background updates are disabled, then just bail out! - if (!getPref("getBoolPref", PREF_APP_UPDATE_BACKGROUND, false)) { - LOG("gCanStageUpdates - staging updates is disabled by preference " + PREF_APP_UPDATE_BACKGROUND); + if (!getPref("getBoolPref", PREF_APP_UPDATE_STAGE_ENABLED, false)) { + LOG("gCanStageUpdates - staging updates is disabled by preference " + PREF_APP_UPDATE_STAGE_ENABLED); return false; } @@ -1604,6 +1604,9 @@ UpdateService.prototype = { "UPDATER_UPDATES_ENABLED"); this._sendBoolPrefTelemetryPing(PREF_APP_UPDATE_AUTO, "UPDATER_UPDATES_AUTOMATIC"); + this._sendBoolPrefTelemetryPing(PREF_APP_UPDATE_STAGE_ENABLED, + "UPDATER_STAGE_ENABLED"); + #ifdef XP_WIN this._sendBoolPrefTelemetryPing(PREF_APP_UPDATE_SERVICE_ENABLED, "UPDATER_SERVICE_ENABLED"); @@ -3213,7 +3216,7 @@ Downloader.prototype = { // download, since otherwise some kind of UI is already visible and // that UI will notify. if (this.background) - shouldShowPrompt = !getPref("getBoolPref", PREF_APP_UPDATE_BACKGROUND, false); + shouldShowPrompt = !getPref("getBoolPref", PREF_APP_UPDATE_STAGE_ENABLED, false); // Tell the updater.exe we're ready to apply. writeStatusFile(getUpdatesDir(), state); diff --git a/toolkit/mozapps/update/test/shared.js b/toolkit/mozapps/update/test/shared.js index 4e9b37556fd..895ee12e5e1 100644 --- a/toolkit/mozapps/update/test/shared.js +++ b/toolkit/mozapps/update/test/shared.js @@ -12,7 +12,7 @@ const AUS_Cr = Components.results; const AUS_Cu = Components.utils; const PREF_APP_UPDATE_AUTO = "app.update.auto"; -const PREF_APP_UPDATE_BACKGROUND = "app.update.stage.enabled"; +const PREF_APP_UPDATE_STAGE_ENABLED = "app.update.stage.enabled"; const PREF_APP_UPDATE_BACKGROUNDERRORS = "app.update.backgroundErrors"; const PREF_APP_UPDATE_BACKGROUNDMAXERRORS = "app.update.backgroundMaxErrors"; const PREF_APP_UPDATE_CERTS_BRANCH = "app.update.certs."; diff --git a/toolkit/mozapps/update/test/unit/test_0030_general.js b/toolkit/mozapps/update/test/unit/test_0030_general.js index 0b94f1db758..cf07040da18 100644 --- a/toolkit/mozapps/update/test/unit/test_0030_general.js +++ b/toolkit/mozapps/update/test/unit/test_0030_general.js @@ -12,7 +12,7 @@ var gExpectedStatusResult; function run_test() { do_test_pending(); do_register_cleanup(end_test); - Services.prefs.setBoolPref(PREF_APP_UPDATE_BACKGROUND, false); + Services.prefs.setBoolPref(PREF_APP_UPDATE_STAGE_ENABLED, false); removeUpdateDirsAndFiles(); setUpdateURLOverride(); // The mock XMLHttpRequest is MUCH faster