Bug 1137447 - New app update telemetry for patch type (complete or partial), extended error codes, and general cleanup. r=bbondy

This commit is contained in:
Robert Strong 2015-03-28 20:20:53 -07:00
parent 1e70119c2e
commit fefdc6b3c8
86 changed files with 1513 additions and 757 deletions

View File

@ -3438,105 +3438,267 @@
"n_buckets" : 10,
"description": "PLACES: Days from last maintenance"
},
"UPDATER_BACKGROUND_CHECK_CODE_EXTERNAL": {
"expires_in_version": "default",
"kind": "enumerated",
"n_values": 50,
"description": "Updater: externally initiated (typically by the application) background update check result code (see PING_BGUC_* constants defined in /toolkit/mozapps/update/nsUpdateService.js)"
"UPDATE_CHECK_NO_UPDATE_EXTERNAL" : {
"expires_in_version": "never",
"kind": "count",
"description": "Update: count of no updates were found for a background update check (externally initiated)"
},
"UPDATER_BACKGROUND_CHECK_CODE_NOTIFY": {
"expires_in_version": "40",
"kind": "enumerated",
"n_values": 50,
"description": "Updater: timer initiated background update check result code (see PING_BGUC_* constants defined in /toolkit/mozapps/update/nsUpdateService.js)"
"UPDATE_CHECK_NO_UPDATE_NOTIFY" : {
"expires_in_version": "never",
"kind": "count",
"description": "Update: count of no updates were found for a background update check (timer initiated)"
},
"UPDATER_INVALID_LASTUPDATETIME_EXTERNAL": {
"expires_in_version": "40",
"kind": "boolean",
"description": "Updater: Whether the last update time is invalid when a background update check was externally requested (typically by the application)"
},
"UPDATER_INVALID_LASTUPDATETIME_NOTIFY": {
"expires_in_version": "40",
"kind": "boolean",
"description": "Updater: Whether the last update time is invalid when a background update check was timer initiated"
},
"UPDATER_LAST_NOTIFY_INTERVAL_DAYS_EXTERNAL": {
"expires_in_version": "40",
"kind": "exponential",
"n_buckets": 10,
"high": "60",
"description": "Updater: The interval in days between the previous and the current background update check when the check was externally requested (typically by the application)"
},
"UPDATER_LAST_NOTIFY_INTERVAL_DAYS_NOTIFY": {
"expires_in_version": "40",
"kind": "exponential",
"n_buckets": 10,
"high": "60",
"description": "Updater: The interval in days between the previous and the current background update check when the check was timer initiated"
},
"UPDATER_STATUS_CODES": {
"UPDATE_CHECK_CODE_EXTERNAL": {
"expires_in_version": "never",
"kind": "enumerated",
"n_values": 50,
"description": "Updater: the status of the latest update performed"
"description": "Update: background update check result code except for no updates found (externally initiated)"
},
"UPDATER_UPDATES_ENABLED": {
"expires_in_version": "default",
"UPDATE_CHECK_CODE_NOTIFY": {
"expires_in_version": "never",
"kind": "enumerated",
"n_values": 50,
"description": "Update: background update check result code except for no updates found (timer initiated)"
},
"UPDATE_CHECK_EXTENDED_ERROR_EXTERNAL": {
"expires_in_version": "never",
"kind": "count",
"keyed": true,
"description": "Update: keyed count (key names are prefixed with AUS_CHECK_EX_ERR_) of background update check extended error code (externally initiated)"
},
"UPDATE_CHECK_EXTENDED_ERROR_NOTIFY": {
"expires_in_version": "never",
"kind": "count",
"keyed": true,
"description": "Update: keyed count (key names are prefixed with AUS_CHECK_EX_ERR_) of background update check extended error code (timer initiated)"
},
"UPDATE_INVALID_LASTUPDATETIME_EXTERNAL": {
"expires_in_version": "never",
"kind": "count",
"description": "Update: count of systems that have a last update time greater than the current time (externally initiated)"
},
"UPDATE_INVALID_LASTUPDATETIME_NOTIFY": {
"expires_in_version": "never",
"kind": "count",
"description": "Update: count of systems that have a last update time greater than the current time (timer initiated)"
},
"UPDATE_LAST_NOTIFY_INTERVAL_DAYS_EXTERNAL": {
"expires_in_version": "never",
"kind": "exponential",
"n_buckets": 60,
"high": "365",
"description": "Update: interval in days since the last background update check (externally initiated)"
},
"UPDATE_LAST_NOTIFY_INTERVAL_DAYS_NOTIFY": {
"expires_in_version": "never",
"kind": "exponential",
"n_buckets": 30,
"high": "180",
"description": "Update: interval in days since the last background update check (timer initiated)"
},
"UPDATE_SERVICE_INSTALLED_EXTERNAL": {
"expires_in_version": "never",
"kind": "boolean",
"description": "Updater: Whether or not updates are enabled"
"description": "Update: whether the service is installed (externally initiated)"
},
"UPDATER_UPDATES_METRO_ENABLED": {
"expires_in_version": "default",
"UPDATE_SERVICE_INSTALLED_NOTIFY": {
"expires_in_version": "never",
"kind": "boolean",
"description": "Updater: Whether or not Metro updates are enabled"
"description": "Update: whether the service is installed (timer initiated)"
},
"UPDATER_UPDATES_AUTOMATIC": {
"expires_in_version": "40",
"UPDATE_SERVICE_MANUALLY_UNINSTALLED_EXTERNAL": {
"expires_in_version": "never",
"kind": "count",
"description": "Update: count of systems that manually uninstalled the service (externally initiated)"
},
"UPDATE_SERVICE_MANUALLY_UNINSTALLED_NOTIFY": {
"expires_in_version": "never",
"kind": "count",
"description": "Update: count of systems that manually uninstalled the service (timer initiated)"
},
"UPDATE_CANNOT_APPLY_EXTERNAL": {
"expires_in_version": "never",
"kind": "boolean",
"description": "Updater: Whether or not updates are automatic"
"description": "Update: systems that cannot apply updates (externally initiated)"
},
"UPDATER_SERVICE_ENABLED": {
"expires_in_version": "default",
"UPDATE_CANNOT_APPLY_NOTIFY": {
"expires_in_version": "never",
"kind": "boolean",
"description": "Updater: Whether or not the MozillaMaintenance service is enabled"
"description": "Update: systems that cannot apply updates (timer initiated)"
},
"UPDATER_SERVICE_ERROR_CODE": {
"expires_in_version": "default",
"UPDATE_CANNOT_STAGE_EXTERNAL": {
"expires_in_version": "never",
"kind": "count",
"description": "Update: count of systems that cannot stage updates (externally initiated)"
},
"UPDATE_CANNOT_STAGE_NOTIFY": {
"expires_in_version": "never",
"kind": "count",
"description": "Update: count of systems that cannot stage updates (timer initiated)"
},
"UPDATE_HAS_PREF_URL_OVERRIDE_EXTERNAL": {
"expires_in_version": "never",
"kind": "count",
"description": "Update: count of systems that have an app.update.url.override preference (externally initiated)"
},
"UPDATE_HAS_PREF_URL_OVERRIDE_NOTIFY": {
"expires_in_version": "never",
"kind": "count",
"description": "Update: count of systems that have an app.update.url.override preference (timer initiated)"
},
"UPDATE_PREF_UPDATE_CANCELATIONS_EXTERNAL": {
"expires_in_version": "never",
"kind": "enumerated",
"n_values": 100,
"description": "Updater: 0=success else SERVICE_* error code defined in /toolkit/mozapps/update/common/errors.h"
"description": "Update: number of sequential update elevation request cancelations greater than 0 (externally initiated)"
},
"UPDATER_SERVICE_ERRORS": {
"expires_in_version": "default",
"UPDATE_PREF_UPDATE_CANCELATIONS_NOTIFY": {
"expires_in_version": "never",
"kind": "enumerated",
"n_values": 100,
"description": "Update: number of sequential update elevation request cancelations greater than 0 (timer initiated)"
},
"UPDATE_PREF_SERVICE_ERRORS_EXTERNAL": {
"expires_in_version": "never",
"kind": "enumerated",
"n_values": 30,
"description": "Updater: The number of MozillaMaintenance service errors that have occurred"
"description": "Update: number of sequential update service errors greater than 0 (externally initiated)"
},
"UPDATER_SERVICE_INSTALLED": {
"expires_in_version": "default",
"kind": "boolean",
"description": "Updater: Whether or not the MozillaMaintenance service is installed"
},
"UPDATER_SERVICE_MANUALLY_UNINSTALLED": {
"expires_in_version": "default",
"kind": "boolean",
"description": "Updater: Whether or not someone manually uninstalled the service."
},
"UPDATER_STAGE_ENABLED": {
"expires_in_version": "40",
"kind": "boolean",
"description": "Updater: Whether or not staging updates are enabled"
},
"UPDATER_HAS_PERMISSIONS": {
"expires_in_version": "40",
"kind": "boolean",
"description": "Updater: Whether or not the updater has permissions"
},
"UPDATER_WIZ_LAST_PAGE_CODE": {
"expires_in_version": "40",
"UPDATE_PREF_SERVICE_ERRORS_NOTIFY": {
"expires_in_version": "never",
"kind": "enumerated",
"n_values": 25,
"description": "Updater: The update wizard page displayed when the UI was closed (mapped in toolkit/mozapps/update/content/updates.js)"
"n_values": 30,
"description": "Update: number of sequential update service errors greater than 0 (timer initiated)"
},
"UPDATE_NOT_PREF_UPDATE_AUTO_EXTERNAL": {
"expires_in_version": "never",
"kind": "count",
"description": "Update: count of when the app.update.auto boolean preference is not the default value of true (true values are not submitted)"
},
"UPDATE_NOT_PREF_UPDATE_AUTO_NOTIFY": {
"expires_in_version": "never",
"kind": "count",
"description": "Update: count of when the app.update.auto boolean preference is not the default value of true (true values are not submitted)"
},
"UPDATE_NOT_PREF_UPDATE_ENABLED_EXTERNAL": {
"expires_in_version": "never",
"kind": "count",
"description": "Update: count of when the app.update.enabled boolean preference is not the default value of true (true values are not submitted)"
},
"UPDATE_NOT_PREF_UPDATE_ENABLED_NOTIFY": {
"expires_in_version": "never",
"kind": "count",
"description": "Update: count of when the app.update.enabled boolean preference is not the default value of true (true values are not submitted)"
},
"UPDATE_NOT_PREF_UPDATE_STAGING_ENABLED_EXTERNAL": {
"expires_in_version": "never",
"kind": "count",
"description": "Update: count of when the app.update.staging.enabled boolean preference is not the default value of true (true values are not submitted)"
},
"UPDATE_NOT_PREF_UPDATE_STAGING_ENABLED_NOTIFY": {
"expires_in_version": "never",
"kind": "count",
"description": "Update: count of when the app.update.staging.enabled boolean preference is not the default value of true (true values are not submitted)"
},
"UPDATE_NOT_PREF_UPDATE_SERVICE_ENABLED_EXTERNAL": {
"expires_in_version": "never",
"kind": "count",
"description": "Update: count of when the app.update.service.enabled boolean preference is not the default value of true (true values are not submitted)"
},
"UPDATE_NOT_PREF_UPDATE_SERVICE_ENABLED_NOTIFY": {
"expires_in_version": "never",
"kind": "count",
"description": "Update: count of when the app.update.service.enabled boolean preference is not the default value of true (true values are not submitted)"
},
"UPDATE_DOWNLOAD_CODE_COMPLETE": {
"expires_in_version": "never",
"kind": "enumerated",
"n_values": 50,
"description": "Update: complete patch download result code"
},
"UPDATE_DOWNLOAD_CODE_PARTIAL": {
"expires_in_version": "never",
"kind": "enumerated",
"n_values": 50,
"description": "Update: complete patch download result code"
},
"UPDATE_STATE_CODE_COMPLETE_STARTUP": {
"expires_in_version": "never",
"kind": "enumerated",
"n_values": 20,
"description": "Update: the state of a complete update from update.status on startup"
},
"UPDATE_STATE_CODE_PARTIAL_STARTUP": {
"expires_in_version": "never",
"kind": "enumerated",
"n_values": 20,
"description": "Update: the state of a partial patch update from update.status on startup"
},
"UPDATE_STATE_CODE_UNKNOWN_STARTUP": {
"expires_in_version": "never",
"kind": "enumerated",
"n_values": 20,
"description": "Update: the state of an unknown patch update from update.status on startup"
},
"UPDATE_STATE_CODE_COMPLETE_STAGE": {
"expires_in_version": "never",
"kind": "enumerated",
"n_values": 20,
"description": "Update: the state of a complete patch update from update.status after staging"
},
"UPDATE_STATE_CODE_PARTIAL_STAGE": {
"expires_in_version": "never",
"kind": "enumerated",
"n_values": 20,
"description": "Update: the state of a partial patch update from update.status after staging"
},
"UPDATE_STATE_CODE_UNKNOWN_STAGE": {
"expires_in_version": "never",
"kind": "enumerated",
"n_values": 20,
"description": "Update: the state of an unknown patch update from update.status after staging"
},
"UPDATE_STATUS_ERROR_CODE_COMPLETE_STARTUP": {
"expires_in_version": "never",
"kind": "enumerated",
"n_values": 100,
"description": "Update: the status error code for a failed complete patch update from update.status on startup"
},
"UPDATE_STATUS_ERROR_CODE_PARTIAL_STARTUP": {
"expires_in_version": "never",
"kind": "enumerated",
"n_values": 100,
"description": "Update: the status error code for a failed partial patch update from update.status on startup"
},
"UPDATE_STATUS_ERROR_CODE_UNKNOWN_STARTUP": {
"expires_in_version": "never",
"kind": "enumerated",
"n_values": 100,
"description": "Update: the status error code for a failed unknown patch update from update.status on startup"
},
"UPDATE_STATUS_ERROR_CODE_COMPLETE_STAGE": {
"expires_in_version": "never",
"kind": "enumerated",
"n_values": 100,
"description": "Update: the status error code for a failed complete patch update from update.status after staging"
},
"UPDATE_STATUS_ERROR_CODE_PARTIAL_STAGE": {
"expires_in_version": "never",
"kind": "enumerated",
"n_values": 100,
"description": "Update: the status error code for a failed partial patch update from update.status after staging"
},
"UPDATE_STATUS_ERROR_CODE_UNKNOWN_STAGE": {
"expires_in_version": "never",
"kind": "enumerated",
"n_values": 100,
"description": "Update: the status error code for a failed unknown patch update from update.status after staging"
},
"UPDATE_WIZ_LAST_PAGE_CODE": {
"expires_in_version": "never",
"kind": "enumerated",
"n_values": 30,
"description": "Update: the update wizard page displayed when the UI was closed (mapped in toolkit/mozapps/update/UpdateTelemetry.jsm)"
},
"THUNDERBIRD_GLODA_SIZE_MB": {
"expires_in_version": "40",

View File

@ -0,0 +1,520 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
this.EXPORTED_SYMBOLS = [
"AUSTLMY"
];
const {classes: Cc, interfaces: Ci, results: Cr, utils: Cu} = Components;
Cu.import("resource://gre/modules/Services.jsm", this);
this.AUSTLMY = {
// Telemetry for the application update background update check occurs when
// the background update timer fires after the update interval which is
// determined by the app.update.interval preference and its telemetry
// histogram IDs have the suffix '_NOTIFY'.
// Telemetry for the externally initiated background update check occurs when
// a call is made to |checkForBackgroundUpdates| which is typically initiated
// by an application when it has determined that the application should have
// received an update. This has separate telemetry so it is possible to
// analyze using the telemetry data systems that have not been updating when
// they should have.
// The update check was performed by the call to checkForBackgroundUpdates in
// nsUpdateService.js.
EXTERNAL: "EXTERNAL",
// The update check was performed by the call to notify in nsUpdateService.js.
NOTIFY: "NOTIFY",
/**
* Values for the UPDATE_CHECK_CODE_NOTIFY and UPDATE_CHECK_CODE_EXTERNAL
* Telemetry histograms.
*/
// No update found (no notification)
CHK_NO_UPDATE_FOUND: 0,
// No incompatible add-ons found during incompatible check (background download)
CHK_ADDON_NO_INCOMPAT: 1,
// Showing prompt due to the update.xml specifying showPrompt
// (update notification)
CHK_SHOWPROMPT_SNIPPET: 2,
// Showing prompt due to preference (update notification)
CHK_SHOWPROMPT_PREF: 3,
// Incompatible add-on check disabled by preference (background download)
CHK_ADDON_PREF_DISABLED: 4,
// Incompatible add-on checke not performed due to same app version as the
// update's app version (background download)
CHK_ADDON_SAME_APP_VER: 5,
// Incompatible add-ons found and all of them have updates (background download)
CHK_ADDON_UPDATES_FOR_INCOMPAT: 6,
// Incompatible add-ons found (update notification)
CHK_ADDON_HAVE_INCOMPAT: 7,
// Already has an active update in progress (no notification)
CHK_HAS_ACTIVEUPDATE: 8,
// A background download is already in progress (no notification)
CHK_IS_DOWNLOADING: 9,
// An update is already staged (no notification)
CHK_IS_STAGED: 10,
// An update is already downloaded (no notification)
CHK_IS_DOWNLOADED: 11,
// Background checks disabled by preference (no notification)
CHK_PREF_DISABLED: 12,
// Update checks disabled by admin locked preference (no notification)
CHK_ADMIN_DISABLED: 13,
// Unable to check for updates per hasUpdateMutex() (no notification)
CHK_NO_MUTEX: 14,
// Unable to check for updates per gCanCheckForUpdates (no notification). This
// should be covered by other codes and is recorded just in case.
CHK_UNABLE_TO_CHECK: 15,
// Background checks disabled for the current session (no notification)
CHK_DISABLED_FOR_SESSION: 16,
// Unable to perform a background check while offline (no notification)
CHK_OFFLINE: 17,
// No update found certificate check failed and threshold reached
// (possible mitm attack notification)
CHK_CERT_ATTR_NO_UPDATE_PROMPT: 18,
// No update found certificate check failed and threshold not reached
// (no notification)
CHK_CERT_ATTR_NO_UPDATE_SILENT: 19,
// Update found certificate check failed and threshold reached
// (possible mitm attack notification)
CHK_CERT_ATTR_WITH_UPDATE_PROMPT: 20,
// Update found certificate check failed and threshold not reached
// (no notification)
CHK_CERT_ATTR_WITH_UPDATE_SILENT: 21,
// General update check failure and threshold reached
// (check failure notification)
CHK_GENERAL_ERROR_PROMPT: 22,
// General update check failure and threshold not reached (no notification)
CHK_GENERAL_ERROR_SILENT: 23,
// No compatible update found though there were updates (no notification)
CHK_NO_COMPAT_UPDATE_FOUND: 24,
// Update found for a previous version (no notification)
CHK_UPDATE_PREVIOUS_VERSION: 25,
// Update found for a version with the never preference set (no notification)
CHK_UPDATE_NEVER_PREF: 26,
// Update found without a type attribute (no notification)
CHK_UPDATE_INVALID_TYPE: 27,
// The system is no longer supported (system unsupported notification)
CHK_UNSUPPORTED: 28,
// Unable to apply updates (manual install to update notification)
CHK_UNABLE_TO_APPLY: 29,
// Unable to check for updates due to no OS version (no notification)
CHK_NO_OS_VERSION: 30,
// Unable to check for updates due to no OS ABI (no notification)
CHK_NO_OS_ABI: 31,
// Invalid url for app.update.url default preference (no notification)
CHK_INVALID_DEFAULT_URL: 32,
// Invalid url for app.update.url user preference (no notification)
CHK_INVALID_USER_OVERRIDE_URL: 33,
// Invalid url for app.update.url.override user preference (no notification)
CHK_INVALID_DEFAULT_OVERRIDE_URL: 34,
/**
* Submit a telemetry ping for the update check result code or a telemetry
* ping for a count type histogram count when no update was found. The no
* update found ping is separate since it is the typical result, is less
* interesting than the other result codes, and it is easier to analyze the
* other codes without including it.
*
* @param aSuffix
* The histogram id suffix for histogram IDs:
* UPDATE_CHECK_CODE_EXTERNAL
* UPDATE_CHECK_CODE_NOTIFY
* UPDATE_CHECK_NO_UPDATE_EXTERNAL
* UPDATE_CHECK_NO_UPDATE_NOTIFY
* @param aCode
* An integer value as defined by the values that start with CHK_ in
* the above section.
*/
pingCheckCode: function UT_pingCheckCode(aSuffix, aCode) {
try {
if (aCode == this.CHK_NO_UPDATE_FOUND) {
let id = "UPDATE_CHECK_NO_UPDATE_" + aSuffix;
// count type histogram
Services.telemetry.getHistogramById(id).add();
} else {
let id = "UPDATE_CHECK_CODE_" + aSuffix;
// enumerated type histogram
Services.telemetry.getHistogramById(id).add(aCode);
}
} catch (e) {
Cu.reportError(e);
}
},
/**
* Submit a telemetry ping for a failed update check's unhandled error code
* when the pingCheckCode is CHK_GENERAL_ERROR_SILENT. The histogram is a
* keyed count type with key names that are prefixed with 'AUS_CHECK_EX_ERR_'.
*
* @param aSuffix
* The histogram id suffix for histogram IDs:
* UPDATE_CHK_EXTENDED_ERROR_EXTERNAL
* UPDATE_CHK_EXTENDED_ERROR_NOTIFY
* @param aCode
* The extended error value return by a failed update check.
*/
pingCheckExError: function UT_pingCheckExError(aSuffix, aCode) {
try {
let id = "UPDATE_CHECK_EXTENDED_ERROR_" + aSuffix;
let val = "AUS_CHECK_EX_ERR_" + aCode;
// keyed count type histogram
Services.telemetry.getKeyedHistogramById(id).add(val);
} catch (e) {
Cu.reportError(e);
}
},
// The state code and if present the status error code were read on startup.
STARTUP: "STARTUP",
// The state code and status error code if present were read after staging.
STAGE: "STAGE",
// Patch type Complete
PATCH_COMPLETE: "COMPLETE",
// Patch type partial
PATCH_PARTIAL: "PARTIAL",
// Patch type unknown
PATCH_UNKNOWN: "UNKNOWN",
/**
* Values for the UPDATE_DOWNLOAD_CODE_COMPLETE and
* UPDATE_DOWNLOAD_CODE_PARTIAL Telemetry histograms.
*/
DWNLD_SUCCESS: 0,
DWNLD_RETRY_OFFLINE: 1,
DWNLD_RETRY_NET_TIMEOUT: 2,
DWNLD_RETRY_CONNECTION_REFUSED: 3,
DWNLD_RETRY_NET_RESET: 4,
DWNLD_ERR_NO_UPDATE: 5,
DWNLD_ERR_NO_UPDATE_PATCH: 6,
DWNLD_ERR_NO_PATCH_FILE: 7,
DWNLD_ERR_PATCH_SIZE_LARGER: 8,
DWNLD_ERR_PATCH_SIZE_NOT_EQUAL: 9,
DWNLD_ERR_BINDING_ABORTED: 10,
DWNLD_ERR_ABORT: 11,
DWNLD_ERR_DOCUMENT_NOT_CACHED: 12,
DWNLD_ERR_VERIFY_NO_REQUEST: 13,
DWNLD_ERR_VERIFY_PATCH_SIZE_NOT_EQUAL: 14,
DWNLD_ERR_VERIFY_NO_HASH_MATCH: 15,
/**
* Submit a telemetry ping for the update download result code.
*
* @param aIsComplete
* If true the histogram is for a patch type complete, if false the
* histogram is for a patch type partial, and when undefined the
* histogram is for an unknown patch type. This is used to determine
* the histogram ID out of the following histogram IDs:
* UPDATE_DOWNLOAD_CODE_COMPLETE
* UPDATE_DOWNLOAD_CODE_PARTIAL
* @param aCode
* An integer value as defined by the values that start with DWNLD_ in
* the above section.
*/
pingDownloadCode: function UT_pingDownloadCode(aIsComplete, aCode) {
let patchType = this.PATCH_UNKNOWN;
if (aIsComplete === true) {
patchType = this.PATCH_COMPLETE;
} else if (aIsComplete === false) {
patchType = this.PATCH_PARTIAL;
}
try {
let id = "UPDATE_DOWNLOAD_CODE_" + patchType;
// enumerated type histogram
Services.telemetry.getHistogramById(id).add(aCode);
} catch (e) {
Cu.reportError(e);
}
},
/**
* Submit a telemetry ping for the update status state code.
*
* @param aSuffix
* The histogram id suffix for histogram IDs:
* UPDATE_STATE_CODE_COMPLETE_STARTUP
* UPDATE_STATE_CODE_PARTIAL_STARTUP
* UPDATE_STATE_CODE_UNKNOWN_STARTUP
* UPDATE_STATE_CODE_COMPLETE_STAGE
* UPDATE_STATE_CODE_PARTIAL_STAGE
* UPDATE_STATE_CODE_UNKNOWN_STAGE
* @param aCode
* An integer value as defined by the values that start with STATE_ in
* the above section for the update state from the update.status file.
*/
pingStateCode: function UT_pingStateCode(aSuffix, aCode) {
try {
let id = "UPDATE_STATE_CODE_" + aSuffix;
// enumerated type histogram
Services.telemetry.getHistogramById(id).add(aCode);
} catch(e) {
Cu.reportError(e);
}
},
/**
* Submit a telemetry ping for the update status error code. This does not
* submit a success value which can be determined from the state code.
*
* @param aSuffix
* The histogram id suffix for histogram IDs:
* UPDATE_STATUS_ERROR_CODE_COMPLETE_STARTUP
* UPDATE_STATUS_ERROR_CODE_PARTIAL_STARTUP
* UPDATE_STATUS_ERROR_CODE_UNKNOWN_STARTUP
* UPDATE_STATUS_ERROR_CODE_COMPLETE_STAGE
* UPDATE_STATUS_ERROR_CODE_PARTIAL_STAGE
* UPDATE_STATUS_ERROR_CODE_UNKNOWN_STAGE
* @param aCode
* An integer value for the error code from the update.status file.
*/
pingStatusErrorCode: function UT_pingStatusErrorCode(aSuffix, aCode) {
try {
let id = "UPDATE_STATUS_ERROR_CODE_" + aSuffix;
// enumerated type histogram
Services.telemetry.getHistogramById(id).add(aCode);
} catch(e) {
Cu.reportError(e);
}
},
/**
* Submit the interval in days since the last notification for this background
* update check or a boolean if the last notification is in the future.
*
* @param aSuffix
* The histogram id suffix for histogram IDs:
* UPDATE_INVALID_LASTUPDATETIME_EXTERNAL
* UPDATE_INVALID_LASTUPDATETIME_NOTIFY
* UPDATE_LAST_NOTIFY_INTERVAL_DAYS_EXTERNAL
* UPDATE_LAST_NOTIFY_INTERVAL_DAYS_NOTIFY
*/
pingLastUpdateTime: function UT_pingLastUpdateTime(aSuffix) {
const PREF_APP_UPDATE_LASTUPDATETIME = "app.update.lastUpdateTime.background-update-timer";
if (Services.prefs.prefHasUserValue(PREF_APP_UPDATE_LASTUPDATETIME)) {
let lastUpdateTimeSeconds = Services.prefs.getIntPref(PREF_APP_UPDATE_LASTUPDATETIME);
if (lastUpdateTimeSeconds) {
let currentTimeSeconds = Math.round(Date.now() / 1000);
if (lastUpdateTimeSeconds > currentTimeSeconds) {
try {
let id = "UPDATE_INVALID_LASTUPDATETIME_" + aSuffix;
// count type histogram
Services.telemetry.getHistogramById().add();
} catch(e) {
Cu.reportError(e);
}
} else {
let intervalDays = (currentTimeSeconds - lastUpdateTimeSeconds) /
(60 * 60 * 24);
try {
let id = "UPDATE_LAST_NOTIFY_INTERVAL_DAYS_" + aSuffix;
// exponential type histogram
Services.telemetry.getHistogramById(id).add(intervalDays);
} catch(e) {
Cu.reportError(e);
}
}
}
}
},
/**
* Submit a telemetry ping for the last page displayed by the update wizard.
*
* @param aPageID
* The page id for the last page displayed.
*/
pingWizLastPageCode: function UT_pingWizLastPageCode(aPageID) {
let pageMap = { invalid: 0,
dummy: 1,
checking: 2,
pluginupdatesfound: 3,
noupdatesfound: 4,
manualUpdate: 5,
unsupported: 6,
incompatibleCheck: 7,
updatesfoundbasic: 8,
updatesfoundbillboard: 9,
license: 10,
incompatibleList: 11,
downloading: 12,
errors: 13,
errorextra: 14,
errorpatching: 15,
finished: 16,
finishedBackground: 17,
installed: 18 };
try {
let id = "UPDATE_WIZ_LAST_PAGE_CODE";
// enumerated type histogram
Services.telemetry.getHistogramById(id).add(pageMap[aPageID] ||
pageMap.invalid);
} catch (e) {
Cu.reportError(e);
}
},
/**
* Submit a telemetry ping for a boolean type histogram that indicates if the
* service is installed and a telemetry ping for a boolean type histogram that
* indicates if the service was at some point installed and is now
* uninstalled.
* Note: the total for the following histogram IDs can be used to determine
* the total number of telemetry timer and externally initiated
* submissions for systems that build with MOZ_MAINTENANCE_SERVICE
* defined:
* UPDATE_SERVICE_INSTALLED_EXTERNAL
* UPDATE_SERVICE_INSTALLED_NOTIFY
*
* @param aSuffix
* The histogram id suffix for histogram IDs:
* UPDATE_SERVICE_INSTALLED_EXTERNAL
* UPDATE_SERVICE_INSTALLED_NOTIFY
* UPDATE_SERVICE_MANUALLY_UNINSTALLED_EXTERNAL
* UPDATE_SERVICE_MANUALLY_UNINSTALLED_NOTIFY
* @param aInstalled
* Whether the service is installed.
*/
pingServiceInstallStatus: function UT_PSIS(aSuffix, aInstalled) {
// Report the error but don't throw since it is more important to
// successfully update than to throw.
if (!("@mozilla.org/windows-registry-key;1" in Cc)) {
Cu.reportError(Cr.NS_ERROR_NOT_AVAILABLE);
return;
}
try {
let id = "UPDATE_SERVICE_INSTALLED_" + aSuffix;
// boolean type histogram
Services.telemetry.getHistogramById(id).add(aInstalled);
} catch(e) {
Cu.reportError(e);
}
let attempted = 0;
try {
let wrk = Cc["@mozilla.org/windows-registry-key;1"].
createInstance(Ci.nsIWindowsRegKey);
wrk.open(wrk.ROOT_KEY_LOCAL_MACHINE,
"SOFTWARE\\Mozilla\\MaintenanceService",
wrk.ACCESS_READ | wrk.WOW64_64);
// Was the service at some point installed, but is now uninstalled?
attempted = wrk.readIntValue("Attempted");
wrk.close();
} catch(e) {
// Since this will throw if the registry key doesn't exist (e.g. the
// service has never been installed) don't report an error.
}
try {
let id = "UPDATE_SERVICE_MANUALLY_UNINSTALLED_" + aSuffix;
if (!aInstalled && attempted) {
// count type histogram
Services.telemetry.getHistogramById(id).add();
}
} catch(e) {
Cu.reportError(e);
}
},
/**
* Submit a telemetry ping for a count type histogram when the expected value
* does not equal the boolean value of a pref or if the pref isn't present
* when the expected value does not equal default value. This lessens the
* amount of data submitted to telemetry.
*
* @param aID
* The histogram ID to report to.
* @param aPref
* The preference to check.
* @param aDefault
* The default value when the preference isn't present.
* @param aExpected (optional)
* If specified and the value is the same as the value that will be
* added the value won't be added to telemetry.
*/
pingBoolPref: function UT_pingBoolPref(aID, aPref, aDefault, aExpected) {
try {
let val = aDefault;
if (Services.prefs.getPrefType(aPref) != Ci.nsIPrefBranch.PREF_INVALID) {
val = Services.prefs.getBoolPref(aPref);
}
if (val != aExpected) {
// count type histogram
Services.telemetry.getHistogramById(aID).add();
}
} catch(e) {
Cu.reportError(e);
}
},
/**
* Submit a telemetry ping for a histogram with the integer value of a
* preference when it is not the expected value or the default value when it
* is not the expected value. This lessens the amount of data submitted to
* telemetry.
*
* @param aID
* The histogram ID to report to.
* @param aPref
* The preference to check.
* @param aDefault
* The default value when the pref is not set.
* @param aExpected (optional)
* If specified and the value is the same as the value that will be
* added the value won't be added to telemetry.
*/
pingIntPref: function UT_pingIntPref(aID, aPref, aDefault, aExpected) {
try {
let val = aDefault;
if (Services.prefs.getPrefType(aPref) != Ci.nsIPrefBranch.PREF_INVALID) {
val = Services.prefs.getIntPref(aPref);
}
if (aExpected === undefined || val != aExpected) {
// enumerated or exponential type histogram
Services.telemetry.getHistogramById(aID).add(val);
}
} catch(e) {
Cu.reportError(e);
}
},
/**
* Submit a telemetry ping for all histogram types that take a single
* parameter to the telemetry add function and the count type histogram when
* the aExpected parameter is specified. If the aExpected parameter is
* specified and it equals the value specified by the aValue
* parameter the telemetry submission will be skipped.
* Note: the total for the following histogram IDs can be used to determine
* the total number of telemetry timer and externally initiated
* submissions:
* UPDATE_CANNOT_APPLY_EXTERNAL
* UPDATE_CANNOT_APPLY_NOTIFY
*
* @param aID
* The histogram ID to report to.
* @param aValue
* The value to add when aExpected is not defined or the value to
* check if it is equal to when aExpected is defined.
* @param aExpected (optional)
* If specified and the value is the same as the value specified by
* aValue parameter the submission will be skipped.
*/
pingGeneric: function UT_pingGeneric(aID, aValue, aExpected) {
try {
if (aExpected === undefined) {
Services.telemetry.getHistogramById(aID).add(aValue);
} else if (aValue != aExpected) {
// count type histogram
Services.telemetry.getHistogramById(aID).add();
}
} catch(e) {
Cu.reportError(e);
}
}
};
Object.freeze(AUSTLMY);

View File

@ -9,9 +9,12 @@
#define OK 0
// Old unused error codes:
// #define MEM_ERROR 1 // Replaced with errors 10-16 (inclusive)
// #define IO_ERROR 2 // Use READ_ERROR or WRITE_ERROR instead
// Error codes that are no longer used should not be used again unless they
// aren't used in client code (e.g. nsUpdateService.js, updates.js,
// UpdatePrompt.js, etc.).
#define MAR_ERROR_EMPTY_ACTION_LIST 1
#define LOADSOURCE_ERROR_WRONG_SIZE 2
// Error codes 3-16 are for general update problems.
#define USAGE_ERROR 3
@ -39,8 +42,7 @@
#define MAR_CHANNEL_MISMATCH_ERROR 22
#define VERSION_DOWNGRADE_ERROR 23
// Error codes 24-34 are related to the maintenance service
// and so are Windows only
// Error codes 24-33 and 49 are for the Windows maintenance service.
#define SERVICE_UPDATER_COULD_NOT_BE_STARTED 24
#define SERVICE_NOT_ENOUGH_COMMAND_LINE_ARGS 25
#define SERVICE_UPDATER_SIGN_ERROR 26
@ -51,26 +53,38 @@
#define SERVICE_UPDATER_NOT_FIXED_DRIVE 31
#define SERVICE_COULD_NOT_LOCK_UPDATER 32
#define SERVICE_INSTALLDIR_ERROR 33
#define SERVICE_COULD_NOT_COPY_UPDATER 49
#define NO_INSTALLDIR_ERROR 34
#define WRITE_ERROR_ACCESS_DENIED 35
// #define WRITE_ERROR_SHARING_VIOLATION 36 // Replaced with errors 46-48
#define WRITE_ERROR_CALLBACK_APP 37
#define INVALID_UPDATER_STATUS_CODE 38
#define UNEXPECTED_BZIP_ERROR 39
#define UNEXPECTED_MAR_ERROR 40
#define UNEXPECTED_BSPATCH_ERROR 41
#define UNEXPECTED_FILE_OPERATION_ERROR 42
#define FILESYSTEM_MOUNT_READWRITE_ERROR 43
#define FOTA_GENERAL_ERROR 44
#define FOTA_UNKNOWN_ERROR 45
#define WRITE_ERROR_SHARING_VIOLATION_SIGNALED 46
#define WRITE_ERROR_SHARING_VIOLATION_NOPROCESSFORPID 47
#define WRITE_ERROR_SHARING_VIOLATION_NOPID 48
#define DELETE_ERROR_EXPECTED_DIR 46
#define DELETE_ERROR_EXPECTED_FILE 47
#define RENAME_ERROR_EXPECTED_FILE 48
// Error codes 24-33 and 49 are for the Windows maintenance service.
#define SERVICE_COULD_NOT_COPY_UPDATER 49
#define WRITE_ERROR_FILE_COPY 61
#define WRITE_ERROR_DELETE_FILE 62
#define WRITE_ERROR_OPEN_PATCH_FILE 63
#define WRITE_ERROR_PATCH_FILE 64
#define WRITE_ERROR_APPLY_DIR_PATH 65
#define WRITE_ERROR_CALLBACK_PATH 66
#define WRITE_ERROR_FILE_ACCESS_DENIED 67
#define WRITE_ERROR_DIR_ACCESS_DENIED 68
#define WRITE_ERROR_DELETE_BACKUP 69
#define WRITE_ERROR_EXTRACT 70
// Error codes 80 through 99 are reserved for nsUpdateService.js
// The following error codes are only used by updater.exe
// when a fallback key exists and XPCShell tests are being run.
// when a fallback key exists for tests.
#define FALLBACKKEY_UNKNOWN_ERROR 100
#define FALLBACKKEY_REGPATH_ERROR 101
#define FALLBACKKEY_NOKEY_ERROR 102

View File

@ -5,15 +5,14 @@
'use strict';
Components.utils.import("resource://gre/modules/DownloadUtils.jsm");
Components.utils.import("resource://gre/modules/AddonManager.jsm");
Components.utils.import("resource://gre/modules/Services.jsm");
// Firefox's macBrowserOverlay.xul includes scripts that define Cc, Ci, and Cr
// so we have to use different names.
const CoC = Components.classes;
const CoI = Components.interfaces;
const CoR = Components.results;
const {classes: CoC, interfaces: CoI, results: CoR, utils: CoU} = Components;
CoU.import("resource://gre/modules/DownloadUtils.jsm", this);
CoU.import("resource://gre/modules/AddonManager.jsm", this);
CoU.import("resource://gre/modules/Services.jsm", this);
CoU.import("resource://gre/modules/UpdateTelemetry.jsm", this);
const XMLNS_XUL = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
@ -22,15 +21,16 @@ const PREF_APP_UPDATE_BILLBOARD_TEST_URL = "app.update.billboard.test_url";
const PREF_APP_UPDATE_CERT_ERRORS = "app.update.cert.errors";
const PREF_APP_UPDATE_ENABLED = "app.update.enabled";
const PREF_APP_UPDATE_LOG = "app.update.log";
const PREF_APP_UPDATE_MANUAL_URL = "app.update.url.manual";
const PREF_APP_UPDATE_NEVER_BRANCH = "app.update.never.";
const PREF_APP_UPDATE_NOTIFIEDUNSUPPORTED = "app.update.notifiedUnsupported";
const PREF_APP_UPDATE_TEST_LOOP = "app.update.test.loop";
const PREF_PLUGINS_UPDATEURL = "plugins.update.url";
const PREF_APP_UPDATE_URL_MANUAL = "app.update.url.manual";
const PREFBRANCH_APP_UPDATE_NEVER = "app.update.never.";
const PREF_EM_HOTFIX_ID = "extensions.hotfix.id";
const PREF_PLUGINS_UPDATE_URL = "plugins.update.url";
const UPDATE_TEST_LOOP_INTERVAL = 2000;
const UPDATE_TEST_LOOP_INTERVAL = 2000;
const URI_UPDATES_PROPERTIES = "chrome://mozapps/locale/update/updates.properties";
@ -145,38 +145,12 @@ var gUpdates = {
_runUnload: true,
/**
* Submit the last page code when the wizard exited. The pageid is used to map
* to an integer instead of using the pageindex since pages can be added and
* removed which would change the page's pageindex.
* @param pageID
* Submit on close telemtry values for the update wizard.
* @param pageID
* The page id for the last page displayed.
*/
_sendLastPageCodePing: function(pageID) {
var pageMap = { invalid: 0,
dummy: 1,
checking: 2,
pluginupdatesfound: 3,
noupdatesfound: 4,
manualUpdate: 5,
unsupported: 6,
incompatibleCheck: 7,
updatesfoundbasic: 8,
updatesfoundbillboard: 9,
license: 10,
incompatibleList: 11,
downloading: 12,
errors: 13,
errorextra: 14,
errorpatching: 15,
finished: 16,
finishedBackground: 17,
installed: 18 };
try {
Services.telemetry.getHistogramById("UPDATER_WIZ_LAST_PAGE_CODE").
add(pageMap[pageID] || pageMap.invalid);
}
catch (e) {
Components.utils.reportError(e);
}
_submitTelemetry: function(aPageID) {
AUSTLMY.pingWizLastPageCode(aPageID);
},
/**
@ -269,7 +243,7 @@ var gUpdates = {
// If the user clicks "No Thanks", we should not prompt them to update to
// this version again unless they manually select "Check for Updates..."
// which will clear all of the "never" prefs.
var neverPrefName = PREF_APP_UPDATE_NEVER_BRANCH + this.update.appVersion;
var neverPrefName = PREFBRANCH_APP_UPDATE_NEVER + this.update.appVersion;
Services.prefs.setBoolPref(neverPrefName, true);
},
@ -288,7 +262,7 @@ var gUpdates = {
var pageid = document.documentElement.currentPage.pageid;
if ("onWizardFinish" in this._pages[pageid])
this._pages[pageid].onWizardFinish();
this._sendLastPageCodePing(pageid);
this._submitTelemetry(pageid);
},
/**
@ -300,7 +274,7 @@ var gUpdates = {
var pageid = document.documentElement.currentPage.pageid;
if ("onWizardCancel" in this._pages[pageid])
this._pages[pageid].onWizardCancel();
this._sendLastPageCodePing(pageid);
this._submitTelemetry(pageid);
},
/**
@ -550,7 +524,7 @@ var gUpdates = {
"or the findUpdates method!";
if (addon.id)
errMsg += " Add-on ID: " + addon.id;
Components.utils.reportError(errMsg);
CoU.reportError(errMsg);
return;
}
@ -574,7 +548,7 @@ var gUpdates = {
self.addons.push(addon);
}
catch (e) {
Components.utils.reportError(e);
CoU.reportError(e);
}
});
@ -627,7 +601,7 @@ var gCheckingPage = {
// clicked "never" for an update, selected "Check for Updates...", and
// then canceled. If we don't clear the "never" prefs future
// notifications will never happen.
Services.prefs.deleteBranch(PREF_APP_UPDATE_NEVER_BRANCH);
Services.prefs.deleteBranch(PREFBRANCH_APP_UPDATE_NEVER);
// The user will be notified if there is an error so clear the background
// check error count.
@ -738,18 +712,18 @@ var gPluginsPage = {
* URL of the plugin updates page
*/
_url: null,
/**
* Initialize
*/
onPageShow: function() {
var prefs = Services.prefs;
if (prefs.getPrefType(PREF_PLUGINS_UPDATEURL) == prefs.PREF_INVALID) {
if (prefs.getPrefType(PREF_PLUGINS_UPDATE_URL) == prefs.PREF_INVALID) {
gUpdates.wiz.goTo("noupdatesfound");
return;
}
this._url = Services.urlFormatter.formatURLPref(PREF_PLUGINS_UPDATEURL);
this._url = Services.urlFormatter.formatURLPref(PREF_PLUGINS_UPDATE_URL);
var link = document.getElementById("pluginupdateslink");
link.setAttribute("href", this._url);
@ -776,7 +750,7 @@ var gPluginsPage = {
gUpdates.setButtons(null, null, "okButton", true);
gUpdates.wiz.getButton("finish").focus();
},
/**
* Finish button clicked.
*/
@ -908,7 +882,7 @@ var gIncompatibleCheckPage = {
*/
var gManualUpdatePage = {
onPageShow: function() {
var manualURL = Services.urlFormatter.formatURLPref(PREF_APP_UPDATE_MANUAL_URL);
var manualURL = Services.urlFormatter.formatURLPref(PREF_APP_UPDATE_URL_MANUAL);
var manualUpdateLinkLabel = document.getElementById("manualUpdateLinkLabel");
manualUpdateLinkLabel.value = manualURL;
manualUpdateLinkLabel.setAttribute("url", manualURL);
@ -1711,7 +1685,7 @@ var gErrorsPage = {
var errorReason = document.getElementById("errorReason");
errorReason.value = statusText;
var manualURL = Services.urlFormatter.formatURLPref(PREF_APP_UPDATE_MANUAL_URL);
var manualURL = Services.urlFormatter.formatURLPref(PREF_APP_UPDATE_URL_MANUAL);
var errorLinkLabel = document.getElementById("errorLinkLabel");
errorLinkLabel.value = manualURL;
errorLinkLabel.setAttribute("url", manualURL);
@ -1750,7 +1724,7 @@ var gErrorExtraPage = {
}
else
document.getElementById("genericBackgroundErrorLabel").hidden = false;
var manualURL = Services.urlFormatter.formatURLPref(PREF_APP_UPDATE_MANUAL_URL);
var manualURL = Services.urlFormatter.formatURLPref(PREF_APP_UPDATE_URL_MANUAL);
var errorLinkLabel = document.getElementById("errorExtraLinkLabel");
errorLinkLabel.value = manualURL;
errorLinkLabel.setAttribute("url", manualURL);
@ -1773,7 +1747,7 @@ var gErrorPatchingPage = {
onWizardNext: function() {
switch (gUpdates.update.selectedPatch.state) {
case STATE_PENDING:
case STATE_PENDING_SVC:
case STATE_PENDING_SVC:
gUpdates.wiz.goTo("finished");
break;
case STATE_DOWNLOADING:

View File

@ -46,4 +46,8 @@ if CONFIG['MOZ_UPDATER']:
'nsUpdateService.js',
]
EXTRA_JS_MODULES += [
'UpdateTelemetry.jsm',
]
JAR_MANIFESTS += ['jar.mn']

File diff suppressed because it is too large Load Diff

View File

@ -5,8 +5,8 @@
const { classes: Cc, interfaces: Ci, utils: Cu } = Components;
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/FileUtils.jsm");
Cu.import("resource://gre/modules/XPCOMUtils.jsm", this);
Cu.import("resource://gre/modules/FileUtils.jsm", this);
const DIR_UPDATES = "updates";
const FILE_UPDATE_STATUS = "update.status";

View File

@ -2,8 +2,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
Components.utils.import("resource://gre/modules/Services.jsm");
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm", this);
Components.utils.import("resource://gre/modules/Services.jsm", this);
const Cc = Components.classes;
const Ci = Components.interfaces;

View File

@ -67,6 +67,8 @@ reason = Bug 918029 - timeout caused by copying too many files.
[test_0103_background_restartNotification_stagingService.xul]
skip-if = os != 'win'
reason = only Windows has the maintenance service.
[test_0104_background_restartNotification_NoIncompatAddons.xul]
[test_0105_background_restartNotification_VersionCompatAddons.xul]
[test_0111_neverButton_basic.xul]
[test_0112_neverButton_billboard.xul]
[test_0113_showNeverForVersionRemovedWithPref.xul]

View File

@ -0,0 +1,51 @@
<?xml version="1.0"?>
<!--
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
-->
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
<window title="Update Wizard pages: background finish with a background download"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="runTestDefault();">
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
<script type="application/javascript"
src="utils.js"/>
<script type="application/javascript">
<![CDATA[
const TESTS = [ {
pageid: PAGEID_FINISHED_BKGRD,
buttonClick: "extra1"
} ];
gDisableNoUpdateAddon = true;
gDisableUpdateCompatibilityAddon = true;
gDisableUpdateVersionAddon = true;
function runTest() {
debugDump("entering");
Services.prefs.setIntPref(PREF_APP_UPDATE_PROMPTWAITTIME, 1);
let url = URL_HTTP_UPDATE_XML + "?showDetails=1" +
getVersionParams(getNewerAppVersion(), getNewerPlatformVersion());
setUpdateURLOverride(url);
gAUS.notify(null);
}
]]>
</script>
<body xmlns="http://www.w3.org/1999/xhtml">
<p id="display"></p>
<div id="content" style="display: none"></div>
<pre id="test"></pre>
</body>
</window>

View File

@ -0,0 +1,50 @@
<?xml version="1.0"?>
<!--
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
-->
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
<window title="Update Wizard pages: background finish with a background download"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="runTestDefault();">
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
<script type="application/javascript"
src="utils.js"/>
<script type="application/javascript">
<![CDATA[
const TESTS = [ {
pageid: PAGEID_FINISHED_BKGRD,
buttonClick: "extra1"
} ];
gDisableNoUpdateAddon = true;
gDisableUpdateCompatibilityAddon = true;
function runTest() {
debugDump("entering");
Services.prefs.setIntPref(PREF_APP_UPDATE_PROMPTWAITTIME, 1);
let url = URL_HTTP_UPDATE_XML + "?showDetails=1" +
getVersionParams(getNewerAppVersion(), getNewerPlatformVersion());
setUpdateURLOverride(url);
gAUS.notify(null);
}
]]>
</script>
<body xmlns="http://www.w3.org/1999/xhtml">
<p id="display"></p>
<div id="content" style="display: none"></div>
<pre id="test"></pre>
</body>
</window>

View File

@ -102,11 +102,17 @@
* updatecompatibility
* the add-on is compatible with the current toolkit version and has a
* compatibility update to make it compatible with the update's toolkit
* version.
* version. Tests that need to have add-ons compatible for the application
* update without updating the add-on's compatibility information can disable
* this add-on by setting the gDisableUpdateCompatibilityAddon variable to
* true.
*
* updateversion
* the add-on is compatible with the current toolkit version and has a version
* update to make it compatible with the update's toolkit version.
* update to make it compatible with the update's toolkit version. Tests that
* need to have add-ons compatible for the application update without updating
* the add-on's to a new version that is compatible can disable this add-on by
* setting the gDisableUpdateVersionAddon variable to true.
*
* userdisabled
* disabled by the user and compatible with the current toolkit version but
@ -119,8 +125,8 @@
const { classes: Cc, interfaces: Ci, manager: Cm, results: Cr,
utils: Cu } = Components;
Cu.import("resource://gre/modules/AddonManager.jsm");
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/AddonManager.jsm", this);
Cu.import("resource://gre/modules/Services.jsm", this);
const IS_MACOSX = ("nsILocalFileMac" in Ci);
@ -151,6 +157,8 @@ const URL_HOST = "http://example.com";
const URL_PATH_UPDATE_XML = "/chrome/toolkit/mozapps/update/tests/chrome/update.sjs";
const REL_PATH_DATA = "chrome/toolkit/mozapps/update/tests/data";
// These two URLs must not contain parameters since tests add their own
// test specific parameters.
const URL_HTTP_UPDATE_XML = URL_HOST + URL_PATH_UPDATE_XML;
const URL_HTTPS_UPDATE_XML = "https://example.com" + URL_PATH_UPDATE_XML;
@ -202,6 +210,8 @@ var gWin;
var gDocElem;
var gPrefToCheck;
var gDisableNoUpdateAddon = false;
var gDisableUpdateCompatibilityAddon = false;
var gDisableUpdateVersionAddon = false;
// Set to true to log additional information for debugging. To log additional
// information for an individual test set DEBUG_AUS_TEST to true in the test's
@ -1125,21 +1135,27 @@ function setupAddons(aCallback) {
function setNoUpdateAddonsDisabledState() {
AddonManager.getAllAddons(function(aAddons) {
aAddons.forEach(function(aAddon) {
if (aAddon.name.indexOf("appdisabled") == 0) {
if (aAddon.name.startsWith("appdisabled")) {
if (!aAddon.userDisabled) {
aAddon.userDisabled = true;
}
}
if (aAddon.name.indexOf("noupdate") == 0) {
if (gDisableNoUpdateAddon) {
if (!aAddon.userDisabled) {
aAddon.userDisabled = true;
}
} else {
if (aAddon.userDisabled) {
aAddon.userDisabled = false;
}
if (aAddon.name.startsWith("noupdate")) {
if (aAddon.userDisabled != gDisableNoUpdateAddon) {
aAddon.userDisabled = gDisableNoUpdateAddon;
}
}
if (aAddon.name.startsWith("updatecompatibility")) {
if (aAddon.userDisabled != gDisableUpdateCompatibilityAddon) {
aAddon.userDisabled = gDisableUpdateCompatibilityAddon;
}
}
if (aAddon.name.startsWith("updateversion")) {
if (aAddon.userDisabled != gDisableUpdateVersionAddon) {
aAddon.userDisabled = gDisableUpdateVersionAddon;
}
}
});

View File

@ -182,5 +182,5 @@ FINISH REMOVEFILE 3/3text1
backup_restore: backup file doesn't exist: 3/3text1.moz-backup
FINISH REMOVEFILE 3/3text0
backup_restore: backup file doesn't exist: 3/3text0.moz-backup
failed: 42
failed: 2
calling QuitProgressUI

View File

@ -182,5 +182,5 @@ FINISH REMOVEFILE Contents/Resources/3/3text1
backup_restore: backup file doesn't exist: Contents/Resources/3/3text1.moz-backup
FINISH REMOVEFILE Contents/Resources/3/3text0
backup_restore: backup file doesn't exist: Contents/Resources/3/3text0.moz-backup
failed: 42
failed: 2
calling QuitProgressUI

View File

@ -35,11 +35,12 @@ const STATE_SUCCEEDED = "succeeded";
const STATE_DOWNLOAD_FAILED = "download-failed";
const STATE_FAILED = "failed";
const STATE_FAILED_READ_ERROR = STATE_FAILED + ": 6";
const STATE_FAILED_WRITE_ERROR = STATE_FAILED + ": 7";
const STATE_FAILED_CHANNEL_MISMATCH_ERROR = STATE_FAILED + ": 22";
const STATE_FAILED_VERSION_DOWNGRADE_ERROR = STATE_FAILED + ": 23";
const STATE_FAILED_UNEXPECTED_FILE_OPERATION_ERROR = STATE_FAILED + ": 42";
const STATE_FAILED_LOADSOURCE_ERROR_WRONG_SIZE = STATE_FAILED + ": 2";
const STATE_FAILED_READ_ERROR = STATE_FAILED + ": 6";
const STATE_FAILED_WRITE_ERROR = STATE_FAILED + ": 7";
const STATE_FAILED_CHANNEL_MISMATCH_ERROR = STATE_FAILED + ": 22";
const STATE_FAILED_VERSION_DOWNGRADE_ERROR = STATE_FAILED + ": 23";
const STATE_FAILED_WRITE_ERROR_FILE_COPY = STATE_FAILED + ": 61";
/**
* Constructs a string representing a remote update xml file.

View File

@ -9,7 +9,8 @@ const { classes: Cc, interfaces: Ci, manager: Cm, results: Cr,
load("../data/xpcshellConstantsPP.js");
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/Services.jsm", this);
Cu.import("resource://gre/modules/ctypes.jsm", this);
const DIR_MACOS = IS_MACOSX ? "Contents/MacOS/" : "";
const DIR_RESOURCES = IS_MACOSX ? "Contents/Resources/" : "";
@ -1196,7 +1197,6 @@ function getSpecialFolderDir(aCSIDL) {
do_throw("Windows only function called by a different platform!");
}
Cu.import("resource://gre/modules/ctypes.jsm");
let lib = ctypes.open("shell32");
let SHGetSpecialFolderPath = lib.declare("SHGetSpecialFolderPathW",
ctypes.winapi_abi,
@ -1531,8 +1531,13 @@ function runUpdate(aExpectedExitValue, aExpectedStatus, aCallback) {
}
let updateLog = getUpdatesPatchDir();
updateLog.append(FILE_UPDATE_LOG);
logTestInfo("contents of " + updateLog.path + ":\n" +
readFileBytes(updateLog).replace(/\r\n/g, "\n"));
// xpcshell tests won't display the entire contents so log each line.
let contents = readFileBytes(updateLog).replace(/\r\n/g, "\n");
let aryLogContents = contents.split("\n");
logTestInfo("contents of " + updateLog.path + ":");
aryLogContents.forEach(function RU_LC_FE(aLine) {
logTestInfo(aLine);
});
}
debugDump("testing updater binary process exitValue against expected " +
"exit value");
@ -2075,7 +2080,7 @@ function runUpdateUsingService(aInitialStatus, aExpectedStatus, aCheckSvcLog) {
function timerCallback(aTimer) {
// Wait for the expected status
let status = readStatusState();
let status = readStatusFile();
// status will probably always be equal to STATE_APPLYING but there is a
// race condition where it would be possible on slower machines where status
// could be equal to STATE_PENDING_SVC.
@ -2098,8 +2103,13 @@ function runUpdateUsingService(aInitialStatus, aExpectedStatus, aCheckSvcLog) {
logTestInfo("update.status contents: " + readStatusFile());
let updateLog = getUpdatesPatchDir();
updateLog.append(FILE_UPDATE_LOG);
logTestInfo("contents of " + updateLog.path + ":\n" +
readFileBytes(updateLog).replace(/\r\n/g, "\n"));
// xpcshell tests won't display the entire contents so log each line.
let contents = readFileBytes(updateLog).replace(/\r\n/g, "\n");
let aryLogContents = contents.split("\n");
logTestInfo("contents of " + updateLog.path + ":");
aryLogContents.forEach(function RUUS_TC_LC_FE(aLine) {
logTestInfo(aLine);
});
}
debugDump("testing update status against expected status");
do_check_eq(status, aExpectedStatus);
@ -2470,7 +2480,22 @@ function checkUpdateLogContents(aCompareLogFile, aExcludeDistributionDir) {
do_check_true(true);
} else {
logTestInfo("log contents are not correct");
do_check_eq(compareLogContents, updateLogContents);
let aryLog = updateLogContents.split("\n");
let aryCompare = compareLogContents.split("\n");
// Pushing an empty string to both arrays makes it so either array's length
// can be used in the for loop below without going out of bounds.
aryLog.push("");
aryCompare.push("");
// xpcshell tests won't display the entire contents so log the incorrect
// line.
for (let i = 0; i < aryLog.length; ++i) {
if (aryCompare[i] != aryLog[i]) {
logTestInfo("the first incorrect line in the log is: " + aryLog[i]);
do_check_eq(aryCompare[i], aryLog[i]);
}
}
// This should never happen!
do_throw("Unable to find incorrect log contents!");
}
}
@ -2489,7 +2514,6 @@ function checkUpdateLogContains(aCheckString) {
do_check_true(true);
} else {
logTestInfo("log file does not contain: " + aCheckString);
logTestInfo("log file contents:\n" + updateLogContents);
do_check_true(false);
}
}

View File

@ -89,5 +89,6 @@ function finishTest() {
do_check_eq(readStatusState(), STATE_PENDING);
checkFilesAfterUpdateFailure(getApplyDirFile, false, false);
unlockDirectory(getAppBaseDir());
standardInit();
waitForFilesInUse();
}

View File

@ -40,5 +40,6 @@ function checkUpdateApplied() {
function checkUpdate() {
checkFilesAfterUpdateFailure(getApplyDirFile, false, false);
checkUpdateLogContains(ERR_RENAME_FILE);
standardInit();
checkCallbackAppLog();
}

View File

@ -41,5 +41,6 @@ function checkUpdateApplied() {
function checkUpdate() {
checkFilesAfterUpdateFailure(getApplyDirFile, true, false);
checkUpdateLogContains(ERR_RENAME_FILE);
standardInit();
checkCallbackAppLog();
}

View File

@ -113,6 +113,7 @@ function checkUpdate() {
checkSymlink();
}
checkUpdateLogContents(LOG_COMPLETE_SUCCESS);
standardInit();
checkCallbackAppLog();
}

View File

@ -53,5 +53,6 @@ function checkUpdate() {
checkFilesAfterUpdateSuccess(getApplyDirFile, false, false);
checkUpdateLogContents(LOG_COMPLETE_SUCCESS);
standardInit();
checkCallbackAppLog();
}

View File

@ -23,5 +23,6 @@ function run_test() {
function checkUpdateApplied() {
checkFilesAfterUpdateSuccess(getApplyDirFile, false, false);
standardInit();
checkCallbackAppLog();
}

View File

@ -23,5 +23,6 @@ function run_test() {
function checkUpdateApplied() {
checkFilesAfterUpdateSuccess(getApplyDirFile, false, false);
standardInit();
checkCallbackAppLog();
}

View File

@ -17,5 +17,6 @@ function run_test() {
function checkUpdateApplied() {
checkFilesAfterUpdateSuccess(getApplyDirFile, false, false);
standardInit();
checkCallbackAppLog();
}

View File

@ -17,5 +17,6 @@ function run_test() {
function checkUpdateApplied() {
checkFilesAfterUpdateSuccess(getApplyDirFile, false, false);
standardInit();
checkCallbackAppLog();
}

View File

@ -26,7 +26,7 @@ function run_test() {
}
// Note that on platforms where we use execv, we cannot trust the return code.
runUpdate((USE_EXECV ? 0 : 1), STATE_FAILED_UNEXPECTED_FILE_OPERATION_ERROR);
runUpdate((USE_EXECV ? 0 : 1), STATE_FAILED_LOADSOURCE_ERROR_WRONG_SIZE);
}
/**
@ -50,5 +50,6 @@ function checkUpdateApplied() {
checkFilesAfterUpdateFailure(getApplyDirFile, false, false);
checkUpdateLogContents(LOG_PARTIAL_FAILURE);
standardInit();
checkCallbackAppLog();
}

View File

@ -41,5 +41,6 @@ function checkUpdateApplied() {
function checkUpdate() {
checkFilesAfterUpdateFailure(getApplyDirFile, false, false);
checkUpdateLogContains(ERR_RENAME_FILE);
standardInit();
checkCallbackAppLog();
}

View File

@ -41,5 +41,6 @@ function checkUpdateApplied() {
function checkUpdate() {
checkFilesAfterUpdateFailure(getApplyDirFile, false, false);
checkUpdateLogContains(ERR_RENAME_FILE);
standardInit();
checkCallbackAppLog();
}

View File

@ -42,5 +42,6 @@ function checkUpdateApplied() {
function checkUpdate() {
checkFilesAfterUpdateFailure(getApplyDirFile, true, false);
checkUpdateLogContains(ERR_RENAME_FILE);
standardInit();
checkCallbackAppLog();
}

View File

@ -42,5 +42,6 @@ function checkUpdateApplied() {
function checkUpdate() {
checkFilesAfterUpdateFailure(getApplyDirFile, true, false);
checkUpdateLogContains(ERR_RENAME_FILE);
standardInit();
checkCallbackAppLog();
}

View File

@ -5,9 +5,6 @@
/* File in use complete MAR file patch apply success test */
function run_test() {
// Set to true due to bug 1123503
DEBUG_AUS_TEST = true;
setupTestCommon();
gTestFiles = gTestFilesCompleteSuccess;
gTestDirs = gTestDirsCompleteSuccess;
@ -37,5 +34,6 @@ function checkUpdateApplied() {
function checkUpdate() {
checkFilesAfterUpdateSuccess(getApplyDirFile, false, true);
checkUpdateLogContains(ERR_BACKUP_DISCARD);
standardInit();
checkCallbackAppLog();
}

View File

@ -34,5 +34,6 @@ function checkUpdateApplied() {
function checkUpdate() {
checkFilesAfterUpdateSuccess(getApplyDirFile, false, true);
checkUpdateLogContains(ERR_BACKUP_DISCARD);
standardInit();
checkCallbackAppLog();
}

View File

@ -44,5 +44,6 @@ function checkUpdateApplied() {
function checkUpdate() {
checkFilesAfterUpdateFailure(getApplyDirFile, false, false);
checkUpdateLogContains(ERR_RENAME_FILE);
standardInit();
checkCallbackAppLog();
}

View File

@ -44,5 +44,6 @@ function checkUpdateApplied() {
function checkUpdate() {
checkFilesAfterUpdateFailure(getApplyDirFile, false, false);
checkUpdateLogContains(ERR_UNABLE_OPEN_DEST);
standardInit();
checkCallbackAppLog();
}

View File

@ -35,7 +35,7 @@ function run_test() {
}
function doUpdate() {
runUpdate(1, STATE_FAILED_WRITE_ERROR, null);
runUpdate(1, STATE_FAILED_WRITE_ERROR_FILE_COPY, null);
// Switch the application to the staged application that was updated.
gStageUpdate = false;
@ -50,5 +50,6 @@ function checkUpdateApplied() {
function checkUpdate() {
checkFilesAfterUpdateFailure(getApplyDirFile, false, false);
checkUpdateLogContains(ERR_RENAME_FILE);
standardInit();
checkCallbackAppLog();
}

View File

@ -35,7 +35,7 @@ function run_test() {
}
function doUpdate() {
runUpdate(1, STATE_FAILED_WRITE_ERROR, null);
runUpdate(1, STATE_FAILED_WRITE_ERROR_FILE_COPY, null);
// Switch the application to the staged application that was updated.
gStageUpdate = false;
@ -50,5 +50,6 @@ function checkUpdateApplied() {
function checkUpdate() {
checkFilesAfterUpdateFailure(getApplyDirFile, false, false);
checkUpdateLogContains(ERR_RENAME_FILE);
standardInit();
checkCallbackAppLog();
}

View File

@ -35,7 +35,7 @@ function run_test() {
}
function doUpdate() {
runUpdate(1, STATE_FAILED_WRITE_ERROR, null);
runUpdate(1, STATE_FAILED_WRITE_ERROR_FILE_COPY, null);
// Switch the application to the staged application that was updated.
gStageUpdate = false;
@ -51,5 +51,6 @@ function checkUpdateApplied() {
function checkUpdate() {
checkFilesAfterUpdateFailure(getApplyDirFile, true, false);
checkUpdateLogContains(ERR_RENAME_FILE);
standardInit();
checkCallbackAppLog();
}

View File

@ -35,7 +35,7 @@ function run_test() {
}
function doUpdate() {
runUpdate(1, STATE_FAILED_WRITE_ERROR, null);
runUpdate(1, STATE_FAILED_WRITE_ERROR_FILE_COPY, null);
// Switch the application to the staged application that was updated.
gStageUpdate = false;
@ -51,5 +51,6 @@ function checkUpdateApplied() {
function checkUpdate() {
checkFilesAfterUpdateFailure(getApplyDirFile, true, false);
checkUpdateLogContains(ERR_RENAME_FILE);
standardInit();
checkCallbackAppLog();
}

View File

@ -52,5 +52,6 @@ function checkUpdateApplied() {
function checkUpdate() {
checkFilesAfterUpdateFailure(getApplyDirFile, false, false);
checkUpdateLogContains(ERR_RENAME_FILE);
standardInit();
checkCallbackAppLog();
}

View File

@ -50,5 +50,6 @@ function checkUpdateApplied() {
function checkUpdate() {
checkFilesAfterUpdateFailure(getApplyDirFile, false, false);
checkUpdateLogContains(ERR_RENAME_FILE);
standardInit();
checkCallbackAppLog();
}

View File

@ -53,5 +53,6 @@ function checkUpdateApplied() {
function checkUpdate() {
checkFilesAfterUpdateFailure(getApplyDirFile, true, false);
checkUpdateLogContains(ERR_RENAME_FILE);
standardInit();
checkCallbackAppLog();
}

View File

@ -51,5 +51,6 @@ function checkUpdateApplied() {
function checkUpdate() {
checkFilesAfterUpdateFailure(getApplyDirFile, true, false);
checkUpdateLogContains(ERR_RENAME_FILE);
standardInit();
checkCallbackAppLog();
}

View File

@ -44,5 +44,6 @@ function checkUpdateApplied() {
function checkUpdate() {
checkFilesAfterUpdateSuccess(getApplyDirFile, false, true);
checkUpdateLogContains(ERR_BACKUP_DISCARD);
standardInit();
checkCallbackAppLog();
}

View File

@ -42,5 +42,6 @@ function checkUpdateApplied() {
function checkUpdate() {
checkFilesAfterUpdateSuccess(getApplyDirFile, false, true);
checkUpdateLogContains(ERR_BACKUP_DISCARD);
standardInit();
checkCallbackAppLog();
}

View File

@ -26,7 +26,7 @@ function run_test() {
applyToDir.lastModifiedTime = yesterday;
}
runUpdate(1, STATE_FAILED_UNEXPECTED_FILE_OPERATION_ERROR);
runUpdate(1, STATE_FAILED_LOADSOURCE_ERROR_WRONG_SIZE);
}
/**
@ -41,5 +41,6 @@ function checkUpdateApplied() {
checkFilesAfterUpdateFailure(getApplyDirFile, true, false);
checkUpdateLogContents(LOG_PARTIAL_FAILURE);
standardInit();
waitForFilesInUse();
}

View File

@ -118,6 +118,7 @@ function finishCheckUpdateApplied() {
}
checkFilesAfterUpdateSuccess(getApplyDirFile, false, false);
checkUpdateLogContents(LOG_COMPLETE_SUCCESS);
standardInit();
checkCallbackAppLog();
}

View File

@ -111,5 +111,6 @@ function finishCheckUpdateApplied() {
checkFilesAfterUpdateSuccess(getApplyDirFile, false, false);
checkUpdateLogContents(LOG_PARTIAL_SUCCESS, true);
standardInit();
checkCallbackAppLog();
}

View File

@ -91,5 +91,6 @@ function finishCheckUpdateApplied() {
checkFilesAfterUpdateSuccess(getApplyDirFile, false, false);
checkUpdateLogContents(LOG_COMPLETE_SUCCESS, true);
standardInit();
checkCallbackAppLog();
}

View File

@ -81,5 +81,6 @@ function finishCheckUpdateApplied() {
checkFilesAfterUpdateSuccess(getApplyDirFile, false, false);
checkUpdateLogContents(LOG_PARTIAL_SUCCESS);
standardInit();
checkCallbackAppLog();
}

View File

@ -37,5 +37,6 @@ function checkUpdateApplied() {
}
checkFilesAfterUpdateSuccess(getApplyDirFile, false, false);
standardInit();
doTestFinish();
}

View File

@ -37,5 +37,6 @@ function checkUpdateApplied() {
}
checkFilesAfterUpdateSuccess(getApplyDirFile, false, false);
standardInit();
doTestFinish();
}

View File

@ -95,5 +95,6 @@ function finishTest() {
do_check_eq(readStatusState(), STATE_PENDING);
checkFilesAfterUpdateFailure(getApplyDirFile, false, false);
unlockDirectory(getAppBaseDir());
standardInit();
waitForFilesInUse();
}

View File

@ -50,5 +50,6 @@ function checkUpdateApplied() {
function checkUpdate() {
checkFilesAfterUpdateFailure(getApplyDirFile, false, false);
checkUpdateLogContains(ERR_RENAME_FILE);
standardInit();
checkCallbackAppLog();
}

View File

@ -51,5 +51,6 @@ function checkUpdateApplied() {
function checkUpdate() {
checkFilesAfterUpdateFailure(getApplyDirFile, true, false);
checkUpdateLogContains(ERR_RENAME_FILE);
standardInit();
checkCallbackAppLog();
}

View File

@ -61,5 +61,6 @@ function checkUpdate() {
checkFilesAfterUpdateSuccess(getApplyDirFile, false, false);
checkUpdateLogContents(LOG_COMPLETE_SUCCESS);
standardInit();
checkCallbackServiceLog();
}

View File

@ -5,9 +5,6 @@
/* Replace app binary complete MAR file staged patch apply success test */
function run_test() {
// Set to true due to bug 1037599
DEBUG_AUS_TEST = true;
if (!shouldRunServiceTest()) {
return;
}
@ -36,5 +33,6 @@ function checkUpdateFinished() {
function checkUpdateApplied() {
checkFilesAfterUpdateSuccess(getApplyDirFile, false, false);
standardInit();
checkCallbackAppLog();
}

View File

@ -33,5 +33,6 @@ function checkUpdateFinished() {
function checkUpdateApplied() {
checkFilesAfterUpdateSuccess(getApplyDirFile, false, false);
standardInit();
checkCallbackAppLog();
}

View File

@ -25,5 +25,6 @@ function setupAppFilesFinished() {
function checkUpdateFinished() {
checkFilesAfterUpdateSuccess(getApplyDirFile, false, false);
standardInit();
checkCallbackServiceLog();
}

View File

@ -25,5 +25,6 @@ function setupAppFilesFinished() {
function checkUpdateFinished() {
checkFilesAfterUpdateSuccess(getApplyDirFile, false, false);
standardInit();
checkCallbackServiceLog();
}

View File

@ -33,7 +33,8 @@ function run_test() {
}
function setupAppFilesFinished() {
runUpdateUsingService(STATE_PENDING_SVC, STATE_FAILED);
runUpdateUsingService(STATE_PENDING_SVC,
STATE_FAILED_LOADSOURCE_ERROR_WRONG_SIZE);
}
/**
@ -59,5 +60,6 @@ function checkUpdateFinished() {
checkFilesAfterUpdateFailure(getApplyDirFile, false, false);
checkUpdateLogContents(LOG_PARTIAL_FAILURE);
standardInit();
checkCallbackServiceLog();
}

View File

@ -51,5 +51,6 @@ function checkUpdateApplied() {
function checkUpdate() {
checkFilesAfterUpdateFailure(getApplyDirFile, false, false);
checkUpdateLogContains(ERR_RENAME_FILE);
standardInit();
checkCallbackAppLog();
}

View File

@ -51,5 +51,6 @@ function checkUpdateApplied() {
function checkUpdate() {
checkFilesAfterUpdateFailure(getApplyDirFile, false, false);
checkUpdateLogContains(ERR_RENAME_FILE);
standardInit();
checkCallbackAppLog();
}

View File

@ -52,5 +52,6 @@ function checkUpdateApplied() {
function checkUpdate() {
checkFilesAfterUpdateFailure(getApplyDirFile, true, false);
checkUpdateLogContains(ERR_RENAME_FILE);
standardInit();
checkCallbackAppLog();
}

View File

@ -52,5 +52,6 @@ function checkUpdateApplied() {
function checkUpdate() {
checkFilesAfterUpdateFailure(getApplyDirFile, true, false);
checkUpdateLogContains(ERR_RENAME_FILE);
standardInit();
checkCallbackAppLog();
}

View File

@ -42,5 +42,6 @@ function checkUpdateFinished() {
function checkUpdate() {
checkFilesAfterUpdateSuccess(getApplyDirFile, false, true);
checkUpdateLogContains(ERR_BACKUP_DISCARD);
standardInit();
checkCallbackServiceLog();
}

View File

@ -42,5 +42,6 @@ function checkUpdateFinished() {
function checkUpdate() {
checkFilesAfterUpdateSuccess(getApplyDirFile, false, true);
checkUpdateLogContains(ERR_BACKUP_DISCARD);
standardInit();
checkCallbackServiceLog();
}

View File

@ -42,7 +42,7 @@ function setupAppFilesFinished() {
}
function doUpdate() {
runUpdateUsingService(STATE_PENDING_SVC, STATE_FAILED);
runUpdateUsingService(STATE_PENDING_SVC, STATE_FAILED_WRITE_ERROR);
}
function checkUpdateFinished() {
@ -52,5 +52,6 @@ function checkUpdateFinished() {
function checkUpdate() {
checkFilesAfterUpdateFailure(getApplyDirFile, false, false);
checkUpdateLogContains(ERR_RENAME_FILE);
standardInit();
checkCallbackServiceLog();
}

View File

@ -42,7 +42,7 @@ function setupAppFilesFinished() {
}
function doUpdate() {
runUpdateUsingService(STATE_PENDING_SVC, STATE_FAILED);
runUpdateUsingService(STATE_PENDING_SVC, STATE_FAILED_READ_ERROR);
}
function checkUpdateFinished() {
@ -52,5 +52,6 @@ function checkUpdateFinished() {
function checkUpdate() {
checkFilesAfterUpdateFailure(getApplyDirFile, false, false);
checkUpdateLogContains(ERR_UNABLE_OPEN_DEST);
standardInit();
checkCallbackServiceLog();
}

View File

@ -43,7 +43,7 @@ function setupAppFilesFinished() {
}
function doUpdate() {
runUpdateUsingService(STATE_PENDING_SVC, STATE_FAILED);
runUpdateUsingService(STATE_PENDING_SVC, STATE_FAILED_WRITE_ERROR_FILE_COPY);
}
function checkUpdateFinished() {
@ -60,5 +60,6 @@ function checkUpdateApplied() {
function checkUpdate() {
checkFilesAfterUpdateFailure(getApplyDirFile, false, false);
checkUpdateLogContains(ERR_RENAME_FILE);
standardInit();
checkCallbackAppLog();
}

View File

@ -43,7 +43,7 @@ function setupAppFilesFinished() {
}
function doUpdate() {
runUpdateUsingService(STATE_PENDING_SVC, STATE_FAILED);
runUpdateUsingService(STATE_PENDING_SVC, STATE_FAILED_WRITE_ERROR_FILE_COPY);
}
function checkUpdateFinished() {
@ -60,5 +60,6 @@ function checkUpdateApplied() {
function checkUpdate() {
checkFilesAfterUpdateFailure(getApplyDirFile, false, false);
checkUpdateLogContains(ERR_RENAME_FILE);
standardInit();
checkCallbackAppLog();
}

View File

@ -43,7 +43,7 @@ function setupAppFilesFinished() {
}
function doUpdate() {
runUpdateUsingService(STATE_PENDING_SVC, STATE_FAILED);
runUpdateUsingService(STATE_PENDING_SVC, STATE_FAILED_WRITE_ERROR_FILE_COPY);
}
function checkUpdateFinished() {
@ -61,5 +61,6 @@ function checkUpdateApplied() {
function checkUpdate() {
checkFilesAfterUpdateFailure(getApplyDirFile, true, false);
checkUpdateLogContains(ERR_RENAME_FILE);
standardInit();
checkCallbackAppLog();
}

View File

@ -43,7 +43,7 @@ function setupAppFilesFinished() {
}
function doUpdate() {
runUpdateUsingService(STATE_PENDING_SVC, STATE_FAILED);
runUpdateUsingService(STATE_PENDING_SVC, STATE_FAILED_WRITE_ERROR_FILE_COPY);
}
function checkUpdateFinished() {
@ -61,5 +61,6 @@ function checkUpdateApplied() {
function checkUpdate() {
checkFilesAfterUpdateFailure(getApplyDirFile, true, false);
checkUpdateLogContains(ERR_RENAME_FILE);
standardInit();
checkCallbackAppLog();
}

View File

@ -6,9 +6,6 @@
fallback test */
function run_test() {
// Set to true due to bug 1123503
DEBUG_AUS_TEST = true;
if (!shouldRunServiceTest()) {
return;
}
@ -65,5 +62,6 @@ function checkUpdateApplied() {
function checkUpdate() {
checkFilesAfterUpdateFailure(getApplyDirFile, false, false);
checkUpdateLogContains(ERR_RENAME_FILE);
standardInit();
checkCallbackAppLog();
}

View File

@ -6,9 +6,6 @@
fallback test */
function run_test() {
// Set to true due to bug 1112284
DEBUG_AUS_TEST = true;
if (!shouldRunServiceTest()) {
return;
}
@ -63,5 +60,6 @@ function checkUpdateApplied() {
function checkUpdate() {
checkFilesAfterUpdateFailure(getApplyDirFile, false, false);
checkUpdateLogContains(ERR_RENAME_FILE);
standardInit();
checkCallbackAppLog();
}

View File

@ -6,9 +6,6 @@
test */
function run_test() {
// Set to true due to bug 1123503
DEBUG_AUS_TEST = true;
if (!shouldRunServiceTest()) {
return;
}
@ -66,5 +63,6 @@ function checkUpdateApplied() {
function checkUpdate() {
checkFilesAfterUpdateFailure(getApplyDirFile, true, false);
checkUpdateLogContains(ERR_RENAME_FILE);
standardInit();
checkCallbackAppLog();
}

View File

@ -6,9 +6,6 @@
test */
function run_test() {
// Set to true due to bug 1112284
DEBUG_AUS_TEST = true;
if (!shouldRunServiceTest()) {
return;
}
@ -64,5 +61,6 @@ function checkUpdateApplied() {
function checkUpdate() {
checkFilesAfterUpdateFailure(getApplyDirFile, true, false);
checkUpdateLogContains(ERR_RENAME_FILE);
standardInit();
checkCallbackAppLog();
}

View File

@ -52,5 +52,6 @@ function checkUpdateFinished() {
function checkUpdate() {
checkFilesAfterUpdateSuccess(getApplyDirFile, false, true);
checkUpdateLogContains(ERR_BACKUP_DISCARD);
standardInit();
checkCallbackServiceLog();
}

View File

@ -50,5 +50,6 @@ function checkUpdateFinished() {
function checkUpdate() {
checkFilesAfterUpdateSuccess(getApplyDirFile, false, true);
checkUpdateLogContains(ERR_BACKUP_DISCARD);
standardInit();
checkCallbackServiceLog();
}

View File

@ -6,9 +6,6 @@
/* General Partial MAR File Staged Patch Apply Failure Test */
function run_test() {
// Set to true due to bug 1109219
DEBUG_AUS_TEST = true;
if (!shouldRunServiceTest()) {
return;
}
@ -37,7 +34,8 @@ function run_test() {
}
function setupAppFilesFinished() {
runUpdateUsingService(STATE_PENDING_SVC, STATE_FAILED);
runUpdateUsingService(STATE_PENDING_SVC,
STATE_FAILED_LOADSOURCE_ERROR_WRONG_SIZE);
}
/**
@ -54,5 +52,6 @@ function checkUpdateFinished() {
checkFilesAfterUpdateFailure(getApplyDirFile, true, false);
checkUpdateLogContents(LOG_PARTIAL_FAILURE);
standardInit();
waitForFilesInUse();
}

View File

@ -116,6 +116,7 @@ function finishCheckUpdateApplied() {
}
checkFilesAfterUpdateSuccess(getApplyDirFile, false, false);
checkUpdateLogContents(LOG_COMPLETE_SUCCESS);
standardInit();
checkCallbackAppLog();
}

View File

@ -6,9 +6,6 @@
/* General Partial MAR File Staged Patch Apply Test */
function run_test() {
// Set to true due to bug 1083653
DEBUG_AUS_TEST = true;
if (!shouldRunServiceTest()) {
return;
}
@ -96,5 +93,6 @@ function finishCheckUpdateApplied() {
checkFilesAfterUpdateSuccess(getApplyDirFile, false, false);
checkUpdateLogContents(LOG_PARTIAL_SUCCESS);
standardInit();
checkCallbackAppLog();
}

View File

@ -63,5 +63,6 @@ function finishCheckUpdateFinished() {
checkFilesAfterUpdateSuccess(getApplyDirFile, false, false);
checkUpdateLogContents(LOG_COMPLETE_SUCCESS);
standardInit();
checkCallbackServiceLog();
}

View File

@ -69,5 +69,6 @@ function finishCheckUpdateFinished() {
checkFilesAfterUpdateSuccess(getApplyDirFile, false, false);
checkUpdateLogContents(LOG_PARTIAL_SUCCESS);
standardInit();
checkCallbackServiceLog();
}

View File

@ -308,7 +308,7 @@ ArchiveReader::ExtractItemToStream(const MarItem *item, FILE *fp)
outlen = outbuf_size - strm.avail_out;
if (outlen) {
if (fwrite(outbuf, outlen, 1, fp) != 1) {
ret = WRITE_ERROR;
ret = WRITE_ERROR_EXTRACT;
break;
}
}

View File

@ -149,7 +149,7 @@ MBS_ApplyPatch(const MBSPatchHeader *header, FILE* patchFile,
diffsrc[i] += fbuffer[i];
}
if ((uint32_t) fwrite(diffsrc, 1, ctrlsrc->x, file) != ctrlsrc->x) {
rv = WRITE_ERROR;
rv = WRITE_ERROR_PATCH_FILE;
goto end;
}
fbuffer += ctrlsrc->x;
@ -162,7 +162,7 @@ MBS_ApplyPatch(const MBSPatchHeader *header, FILE* patchFile,
goto end;
}
if ((uint32_t) fwrite(extrasrc, 1, ctrlsrc->y, file) != ctrlsrc->y) {
rv = WRITE_ERROR;
rv = WRITE_ERROR_PATCH_FILE;
goto end;
}
extrasrc += ctrlsrc->y;

View File

@ -640,9 +640,9 @@ static int ensure_copy(const NS_tchar *path, const NS_tchar *dest)
if (!result) {
LOG(("ensure_copy: failed to copy the file " LOG_S " over to " LOG_S ", lasterr: %x",
path, dest, GetLastError()));
return WRITE_ERROR;
return WRITE_ERROR_FILE_COPY;
}
return 0;
return OK;
#else
struct NS_tstat_t ss;
int rv = NS_tlstat(path, &ss);
@ -706,7 +706,7 @@ static int ensure_copy(const NS_tchar *path, const NS_tchar *dest)
LOG(("ensure_copy: failed to write the file: " LOG_S ", err: %d",
dest, errno));
free(buffer);
return WRITE_ERROR;
return WRITE_ERROR_FILE_COPY;
}
written += chunkWritten;
@ -822,7 +822,7 @@ static int rename_file(const NS_tchar *spath, const NS_tchar *dpath,
if (allowDirs && !S_ISDIR(spathInfo.st_mode)) {
LOG(("rename_file: path present, but not a file: " LOG_S ", err: %d",
spath, errno));
return UNEXPECTED_FILE_OPERATION_ERROR;
return RENAME_ERROR_EXPECTED_FILE;
} else {
LOG(("rename_file: proceeding to rename the directory"));
}
@ -832,7 +832,7 @@ static int rename_file(const NS_tchar *spath, const NS_tchar *dpath,
if (ensure_remove(dpath)) {
LOG(("rename_file: destination file exists and could not be " \
"removed: " LOG_S, dpath));
return WRITE_ERROR;
return WRITE_ERROR_DELETE_FILE;
}
}
@ -894,7 +894,7 @@ static int backup_discard(const NS_tchar *path)
if (rename_file(backup, path)) {
LOG(("backup_discard: failed to rename file:" LOG_S ", dst:" LOG_S,
backup, path));
return WRITE_ERROR;
return WRITE_ERROR_DELETE_BACKUP;
}
// The MoveFileEx call to remove the file on OS reboot will fail if the
// process doesn't have write access to the HKEY_LOCAL_MACHINE registry key
@ -911,7 +911,7 @@ static int backup_discard(const NS_tchar *path)
}
#else
if (rv)
return WRITE_ERROR;
return WRITE_ERROR_DELETE_BACKUP;
#endif
return OK;
@ -1009,7 +1009,7 @@ RemoveFile::Prepare()
if (!S_ISREG(fileInfo.st_mode)) {
LOG(("path present, but not a file: " LOG_S, mFile));
return UNEXPECTED_FILE_OPERATION_ERROR;
return DELETE_ERROR_EXPECTED_FILE;
}
NS_tchar *slash = (NS_tchar *) NS_tstrrchr(mFile, NS_T('/'));
@ -1023,7 +1023,7 @@ RemoveFile::Prepare()
if (rv) {
LOG(("access failed: %d", errno));
return WRITE_ERROR;
return WRITE_ERROR_FILE_ACCESS_DENIED;
}
return OK;
@ -1118,13 +1118,13 @@ RemoveDir::Prepare()
if (!S_ISDIR(dirInfo.st_mode)) {
LOG(("path present, but not a directory: " LOG_S, mDir));
return UNEXPECTED_FILE_OPERATION_ERROR;
return DELETE_ERROR_EXPECTED_DIR;
}
rv = NS_taccess(mDir, W_OK);
if (rv) {
LOG(("access failed: %d, %d", rv, errno));
return WRITE_ERROR;
return WRITE_ERROR_DIR_ACCESS_DENIED;
}
return OK;
@ -1310,7 +1310,7 @@ PatchFile::LoadSourceFile(FILE* ofile)
if (uint32_t(os.st_size) != header.slen) {
LOG(("LoadSourceFile: destination file size %d does not match expected size %d",
uint32_t(os.st_size), header.slen));
return UNEXPECTED_FILE_OPERATION_ERROR;
return LOADSOURCE_ERROR_WRONG_SIZE;
}
buf = (unsigned char *) malloc(header.slen);
@ -1461,7 +1461,7 @@ PatchFile::Execute()
// Creating the file, setting the size, and then closing the file handle
// lessens fragmentation more than any other method tested. Other methods that
// have been tested are:
// 1. _chsize / _chsize_s reduced fragmentation but though not completely.
// 1. _chsize / _chsize_s reduced fragmentation though not completely.
// 2. _get_osfhandle and then setting the size reduced fragmentation though
// not completely. There are also reports of _get_osfhandle failing on
// mingw.
@ -1482,7 +1482,8 @@ PatchFile::Execute()
CloseHandle(hfile);
}
AutoFile ofile(ensure_open(mFile, shouldTruncate ? NS_T("wb+") : NS_T("rb+"), ss.st_mode));
AutoFile ofile(ensure_open(mFile, shouldTruncate ? NS_T("wb+") : NS_T("rb+"),
ss.st_mode));
#elif defined(XP_MACOSX)
AutoFile ofile(ensure_open(mFile, NS_T("wb+"), ss.st_mode));
// Modified code from FileUtils.cpp
@ -1504,7 +1505,7 @@ PatchFile::Execute()
if (ofile == nullptr) {
LOG(("unable to create new file: " LOG_S ", err: %d", mFile, errno));
return WRITE_ERROR;
return WRITE_ERROR_OPEN_PATCH_FILE;
}
#ifdef XP_WIN
@ -1942,7 +1943,8 @@ ProcessReplaceRequest()
// name, so that if the user has used a different case when launching the
// application, the installation directory's name does not change.
NS_tchar destDir[MAXPATHLEN];
if (!GetLongPathNameW(gInstallDirPath, destDir, sizeof(destDir)/sizeof(destDir[0]))) {
if (!GetLongPathNameW(gInstallDirPath, destDir,
sizeof(destDir)/sizeof(destDir[0]))) {
return NO_INSTALLDIR_ERROR;
}
#else
@ -1990,6 +1992,8 @@ ProcessReplaceRequest()
}
#endif
if (rv) {
// The status file will have 'pending' written to it so there is no value in
// returning an error specific for this failure.
LOG(("Moving destDir to tmpDir failed, err: %d", rv));
return rv;
}
@ -2013,6 +2017,8 @@ ProcessReplaceRequest()
if (rv2) {
LOG(("Moving tmpDir back to destDir failed, err: %d", rv2));
}
// The status file will be have 'pending' written to it so there is no value
// in returning an error specific for this failure.
return rv;
}
@ -2084,7 +2090,8 @@ ReadMARChannelIDs(const NS_tchar *path, MARChannelStringTable *results)
static int
GetUpdateFileName(NS_tchar *fileName, int maxChars)
{
#if defined(MOZ_WIDGET_GONK) // If an update.link file exists, then it will contain the name
#if defined(MOZ_WIDGET_GONK)
// If an update.link file exists, then it will contain the name
// of the update file (terminated by a newline).
NS_tchar linkFileName[MAXPATHLEN];
@ -2226,7 +2233,8 @@ UpdateThreadFunc(void *param)
// staged directory as it won't be useful any more.
ensure_remove_recursive(gWorkingDirPath);
WriteStatusFile(sUsingService ? "pending-service" : "pending");
putenv(const_cast<char*>("MOZ_PROCESS_UPDATES=")); // We need to use --process-updates again in the tests
// We need to use --process-updates again in the tests
putenv(const_cast<char*>("MOZ_PROCESS_UPDATES="));
reportRealResults = false; // pretend success
}
@ -2439,7 +2447,8 @@ int NS_main(int argc, NS_tchar **argv)
fprintf(fs, "%d", oomScoreAdj);
fclose(fs);
} else {
LOG(("Unable to open /proc/self/oom_score_adj for writing, errno = %d", errno));
LOG(("Unable to open /proc/self/oom_score_adj for writing, errno = %d",
errno));
}
}
}
@ -2623,7 +2632,8 @@ int NS_main(int argc, NS_tchar **argv)
// are available. If not don't use the service.
if (useService) {
WCHAR maintenanceServiceKey[MAX_PATH + 1];
if (CalculateRegistryPathFromFilePath(gInstallDirPath, maintenanceServiceKey)) {
if (CalculateRegistryPathFromFilePath(gInstallDirPath,
maintenanceServiceKey)) {
HKEY baseKey = nullptr;
if (RegOpenKeyExW(HKEY_LOCAL_MACHINE,
maintenanceServiceKey, 0,
@ -2712,7 +2722,8 @@ int NS_main(int argc, NS_tchar **argv)
bool updateStatusSucceeded = false;
if (IsUpdateStatusSucceeded(updateStatusSucceeded) &&
updateStatusSucceeded) {
if (!LaunchWinPostProcess(gInstallDirPath, gPatchDirPath, false, nullptr)) {
if (!LaunchWinPostProcess(gInstallDirPath, gPatchDirPath, false,
nullptr)) {
fprintf(stderr, "The post update process which runs as the user"
" for service update could not be launched.");
}
@ -2855,7 +2866,7 @@ int NS_main(int argc, NS_tchar **argv)
sizeof(applyDirLongPath)/sizeof(applyDirLongPath[0]))) {
LOG(("NS_main: unable to find apply to dir: " LOG_S, gWorkingDirPath));
LogFinish();
WriteStatusFile(WRITE_ERROR);
WriteStatusFile(WRITE_ERROR_APPLY_DIR_PATH);
EXIT_WHEN_ELEVATED(elevatedLockFilePath, updateLockFileHandle, 1);
if (argc > callbackIndex) {
LaunchCallbackApp(argv[5], argc - callbackIndex,
@ -2900,14 +2911,15 @@ int NS_main(int argc, NS_tchar **argv)
size_t callbackPrefixLength = PathCommonPrefixW(argv[callbackIndex],
installDir,
nullptr);
NS_tstrncpy(p, argv[callbackIndex] + std::max(callbackPrefixLength, commonPrefixLength), bufferLeft);
NS_tstrncpy(p, argv[callbackIndex] + std::max(callbackPrefixLength,
commonPrefixLength), bufferLeft);
targetPath = buffer;
}
if (!GetLongPathNameW(targetPath, callbackLongPath,
sizeof(callbackLongPath)/sizeof(callbackLongPath[0]))) {
LOG(("NS_main: unable to find callback file: " LOG_S, targetPath));
LogFinish();
WriteStatusFile(WRITE_ERROR);
WriteStatusFile(WRITE_ERROR_CALLBACK_PATH);
EXIT_WHEN_ELEVATED(elevatedLockFilePath, updateLockFileHandle, 1);
if (argc > callbackIndex) {
LaunchCallbackApp(argv[5],
@ -3187,7 +3199,7 @@ ActionList::Prepare()
// actually done. See bug 327140.
if (mCount == 0) {
LOG(("empty action list"));
return UNEXPECTED_MAR_ERROR;
return MAR_ERROR_EMPTY_ACTION_LIST;
}
Action *a = mFirst;
@ -3297,7 +3309,8 @@ int add_dir_entries(const NS_tchar *dirpath, ActionList *list)
Action *action = new RemoveFile();
rv = action->Parse(quotedpath);
if (rv) {
LOG(("add_dir_entries Parse error on recurse: " LOG_S ", err: %d", quotedpath, rv));
LOG(("add_dir_entries Parse error on recurse: " LOG_S ", err: %d",
quotedpath, rv));
return rv;
}
@ -3315,7 +3328,8 @@ int add_dir_entries(const NS_tchar *dirpath, ActionList *list)
Action *action = new RemoveDir();
rv = action->Parse(quotedpath);
if (rv)
LOG(("add_dir_entries Parse error on close: " LOG_S ", err: %d", quotedpath, rv));
LOG(("add_dir_entries Parse error on close: " LOG_S ", err: %d",
quotedpath, rv));
else
list->Append(action);
}