Bug 767471 - Report telemetry data for if the MozillaMaintenance service was ever manually uninstalled. r=rstrong
authorBrian R. Bondy <netzen@gmail.com>
Mon, 25 Jun 2012 15:17:45 -0400
changeset 102876 539051fd90c2440b243f0c5402bd613a02901638
parent 102875 c562af29a9dba532c0c5e5d35ccfaa4d5be87a74
child 102877 892392714fc2667b2bc29ca447cfef94cafaf46f
push id191
push userlsblakk@mozilla.com
push dateFri, 05 Oct 2012 17:12:53 +0000
treeherdermozilla-release@ddb22ac6c03b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersrstrong
bugs767471
milestone16.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 767471 - Report telemetry data for if the MozillaMaintenance service was ever manually uninstalled. r=rstrong
toolkit/components/maintenanceservice/serviceinstall.cpp
toolkit/components/telemetry/TelemetryHistograms.h
toolkit/mozapps/update/nsUpdateService.js
--- a/toolkit/components/maintenanceservice/serviceinstall.cpp
+++ b/toolkit/components/maintenanceservice/serviceinstall.cpp
@@ -159,19 +159,19 @@ UpdateServiceDescription(SC_HANDLE servi
   LOG(("The service description was updated successfully.\n"));
   return TRUE;
 }
 
 /**
  * Determines if the MozillaMaintenance service path needs to be updated
  * and fixes it if it is wrong.
  *
- * @param service            A handle to the service to fix.
- * @param currentServicePath The current (possibly wrong) path that is used.
- * @param wasFixNeeded       Out parameter set to TRUE if a fix was needed.
+ * @param service             A handle to the service to fix.
+ * @param currentServicePath  The current (possibly wrong) path that is used.
+ * @param servicePathWasWrong Out parameter set to TRUE if a fix was needed.
  * @return TRUE if the service path is now correct.
 */
 BOOL
 FixServicePath(SC_HANDLE service,
                LPCWSTR currentServicePath,
                BOOL &servicePathWasWrong)
 {
   // When we originally upgraded the MozillaMaintenance service we
--- a/toolkit/components/telemetry/TelemetryHistograms.h
+++ b/toolkit/components/telemetry/TelemetryHistograms.h
@@ -314,16 +314,17 @@ HISTOGRAM(PLACES_FRECENCY_CALC_TIME_MS, 
  * Updater telemetry.
  */
 HISTOGRAM(UPDATER_STATUS_CODES, 1, 50, 51, LINEAR, "Updater: the status of the latest update performed")
 HISTOGRAM_BOOLEAN(UPDATER_UPDATES_ENABLED, "Updater: Whether or not updates are enabled")
 HISTOGRAM_BOOLEAN(UPDATER_UPDATES_AUTOMATIC, "Updater: Whether or not updates are automatic")
 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_SERVICE_MANUALLY_UNINSTALLED, "Updater: Whether or not someone manually uninstalled the service.")
 HISTOGRAM_BOOLEAN(UPDATER_STAGE_ENABLED, "Updater: Whether or not staging updates are enabled")
 HISTOGRAM_BOOLEAN(UPDATER_HAS_PERMISSIONS, "Updater: Whether or not the updater has permissions")
 
 /**
  * Thunderbird-specific telemetry.
  */
 // Disable this application-specific #ifdef ftb. (See bug 710562)
 // #ifdef MOZ_THUNDERBIRD
--- a/toolkit/mozapps/update/nsUpdateService.js
+++ b/toolkit/mozapps/update/nsUpdateService.js
@@ -1693,36 +1693,47 @@ UpdateService.prototype = {
       Components.utils.reportError(e);
     }
   },
 
 #ifdef XP_WIN
   /**
    * Submit a telemetry ping with a boolean value which indicates if the service
    * is installed.
+   * Also submits a telemetry ping with a boolean value which indicates if the
+   * service was at some point installed, but is now uninstalled.
    */
   _sendServiceInstalledTelemetryPing: function AUS__svcInstallTelemetryPing() {
     let installed = 0;
+    let attempted = 0;
     try {
       let wrk = Components.classes["@mozilla.org/windows-registry-key;1"]
                 .createInstance(Components.interfaces.nsIWindowsRegKey);
       wrk.open(wrk.ROOT_KEY_LOCAL_MACHINE,
                "SOFTWARE\\Mozilla\\MaintenanceService",
                wrk.ACCESS_READ | wrk.WOW64_64);
+      attempted = wrk.readIntValue("Attempted");
       installed = wrk.readIntValue("Installed");
       wrk.close();
     } catch(e) {
     }
     try {
       let h = Services.telemetry.getHistogramById("UPDATER_SERVICE_INSTALLED");
       h.add(installed);
     } catch(e) {
       // Don't allow any exception to be propagated.
       Components.utils.reportError(e);
     }
+    try {
+      let h = Services.telemetry.getHistogramById("UPDATER_SERVICE_MANUALLY_UNINSTALLED");
+      h.add(!installed && attempted ? 1 : 0);
+    } catch(e) {
+      // Don't allow any exception to be propagated.
+      Components.utils.reportError(e);
+    }
   },
 #endif
 
   /**
    * Submit a telemetry ping with the int value of a pref for a histogram
    *
    * @param  pref
    *         The preference to report