Bug 1365845 - Reset app.update.cancelations after a successful update. r=mhowell

This commit is contained in:
Robert Strong 2017-06-06 20:26:14 -07:00
parent 772debd9ae
commit 25f82c418c
3 changed files with 12 additions and 1 deletions

View File

@ -954,7 +954,7 @@ function handleUpdateFailure(update, errorCode) {
Services.prefs.setIntPref(PREF_APP_UPDATE_CANCELATIONS, cancelations);
if (AppConstants.platform == "macosx") {
let osxCancelations = getPref("getIntPref",
PREF_APP_UPDATE_CANCELATIONS_OSX, 0);
PREF_APP_UPDATE_CANCELATIONS_OSX, 0);
osxCancelations++;
Services.prefs.setIntPref(PREF_APP_UPDATE_CANCELATIONS_OSX,
osxCancelations);
@ -1786,6 +1786,9 @@ UpdateService.prototype = {
}
if (status == STATE_SUCCEEDED) {
if (Services.prefs.prefHasUserValue(PREF_APP_UPDATE_CANCELATIONS)) {
Services.prefs.clearUserPref(PREF_APP_UPDATE_CANCELATIONS);
}
update.statusText = gUpdateBundle.GetStringFromName("installSuccess");
// Update the patch's metadata.

View File

@ -11,6 +11,7 @@ Cu.import("resource://gre/modules/XPCOMUtils.jsm");
const PREF_APP_UPDATE_AUTO = "app.update.auto";
const PREF_APP_UPDATE_BACKGROUNDERRORS = "app.update.backgroundErrors";
const PREF_APP_UPDATE_BACKGROUNDMAXERRORS = "app.update.backgroundMaxErrors";
const PREF_APP_UPDATE_CANCELATIONS = "app.update.cancelations";
const PREF_APP_UPDATE_CHANNEL = "app.update.channel";
const PREF_APP_UPDATE_DOORHANGER = "app.update.doorhanger";
const PREF_APP_UPDATE_DOWNLOADPROMPTATTEMPTS = "app.update.download.attempts";

View File

@ -8,6 +8,8 @@ function run_test() {
debugDump("testing that the update.log is moved after a successful update");
Services.prefs.setIntPref(PREF_APP_UPDATE_CANCELATIONS, 5);
writeUpdatesToXMLFile(getLocalUpdatesXMLString(""), false);
let patches = getLocalPatchString(null, null, null, null, null, null,
STATE_PENDING);
@ -20,6 +22,11 @@ function run_test() {
standardInit();
let cancelations = Services.prefs.getIntPref(PREF_APP_UPDATE_CANCELATIONS, 0);
Assert.equal(cancelations, 0,
"the " + PREF_APP_UPDATE_CANCELATIONS + " preference " +
MSG_SHOULD_EQUAL);
Assert.ok(!log.exists(), MSG_SHOULD_NOT_EXIST);
log = getUpdateLog(FILE_LAST_UPDATE_LOG);