Bug 763016 - Report telemetry data for if the MozillaMaintenance service is installed. r=rstrong

This commit is contained in:
Brian R. Bondy 2012-06-15 11:59:35 -04:00
Родитель fd2df49f11
Коммит 7c17764634
2 изменённых файлов: 29 добавлений и 0 удалений

Просмотреть файл

@ -318,6 +318,7 @@ HISTOGRAM_BOOLEAN(UPDATER_UPDATES_ENABLED, "Updater: Whether or not updates are
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")
/**
* Thunderbird-specific telemetry.

Просмотреть файл

@ -1609,6 +1609,7 @@ UpdateService.prototype = {
"UPDATER_SERVICE_ENABLED");
this._sendIntPrefTelemetryPing(PREF_APP_UPDATE_SERVICE_ERRORS,
"UPDATER_SERVICE_ERRORS");
this._sendServiceInstalledTelemetryPing();
#endif
update.statusText = gUpdateBundle.GetStringFromName("installSuccess");
@ -1666,6 +1667,33 @@ UpdateService.prototype = {
}
},
#ifdef XP_WIN
/**
* Submit a telemetry ping with a boolean value which indicates if the service
* is installed.
*/
_sendServiceInstalledTelemetryPing: function AUS__svcInstallTelemetryPing() {
let installed = 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);
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);
}
},
#endif
/**
* Submit a telemetry ping with the int value of a pref for a histogram
*