Bug 763025 - Report telemetry data for the number of people that cannot upgrade due to permissions. r=rstrong

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

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

@ -320,6 +320,7 @@ HISTOGRAM_BOOLEAN(UPDATER_SERVICE_ENABLED, "Updater: Whether or not the MozillaM
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")
HISTOGRAM_BOOLEAN(UPDATER_HAS_PERMISSIONS, "Updater: Whether or not the updater has permissions")
/**
* Thunderbird-specific telemetry.

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

@ -329,6 +329,16 @@ function testWriteAccess(updateTestFile, createDirectory) {
}
XPCOMUtils.defineLazyGetter(this, "gCanApplyUpdates", function aus_gCanApplyUpdates() {
function submitHasPermissionsTelemetryPing(val) {
try {
let h = Services.telemetry.getHistogramById("UPDATER_HAS_PERMISSIONS");
h.add(+val);
} catch(e) {
// Don't allow any exception to be propagated.
Components.utils.reportError(e);
}
}
try {
var updateTestFile = getUpdateFile([FILE_PERMS_TEST]);
LOG("gCanApplyUpdates - testing write access " + updateTestFile.path);
@ -408,10 +418,12 @@ XPCOMUtils.defineLazyGetter(this, "gCanApplyUpdates", function aus_gCanApplyUpda
catch (e) {
LOG("gCanApplyUpdates - unable to apply updates. Exception: " + e);
// No write privileges to install directory
submitHasPermissionsTelemetryPing(false);
return false;
}
LOG("gCanApplyUpdates - able to apply updates");
submitHasPermissionsTelemetryPing(true);
return true;
});