mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-13 13:25:37 +00:00
Bug 757885 - Handle falling back to non-staged updates correctly when an update fails to be staged in the background; r=rstrong
This commit is contained in:
parent
d123a1f4e2
commit
d81f2aa046
@ -525,25 +525,24 @@ appUpdater.prototype =
|
||||
this.selectPanel("applying");
|
||||
let update = this.um.activeUpdate;
|
||||
let self = this;
|
||||
let timer = Components.classes["@mozilla.org/timer;1"]
|
||||
.createInstance(Components.interfaces.nsITimer);
|
||||
timer.initWithCallback(function () {
|
||||
Services.obs.addObserver(function (aSubject, aTopic, aData) {
|
||||
// Update the UI when the background updater is finished
|
||||
let status = update.state;
|
||||
if (status == "applied" || status == "applied-service") {
|
||||
if (status == "applied" || status == "applied-service" ||
|
||||
status == "pending" || status == "pending-service") {
|
||||
// If the update is successfully applied, or if the updater has
|
||||
// fallen back to non-staged updates, show the Restart to Update
|
||||
// button.
|
||||
self.selectPanel("updateButtonBox");
|
||||
self.setupUpdateButton("update.restart." +
|
||||
(self.isMajor ? "upgradeButton" : "updateButton"));
|
||||
timer.cancel();
|
||||
timer = null;
|
||||
} else if (status == "failed") {
|
||||
// Background update has failed, let's show the UI responsible for
|
||||
// prompting the user to update manually.
|
||||
self.selectPanel("downloadFailed");
|
||||
timer.cancel();
|
||||
timer = null;
|
||||
}
|
||||
}, 500, timer.TYPE_REPEATING_SLACK);
|
||||
Services.obs.removeObserver(arguments.callee, "update-staged");
|
||||
}, "update-staged", false);
|
||||
} else {
|
||||
this.selectPanel("updateButtonBox");
|
||||
this.setupUpdateButton("update.restart." +
|
||||
|
@ -1604,7 +1604,11 @@ var gDownloadingPage = {
|
||||
if (aTopic == "update-staged") {
|
||||
this.cleanUp();
|
||||
if (aData == STATE_APPLIED ||
|
||||
aData == STATE_APPLIED_SVC) {
|
||||
aData == STATE_APPLIED_SVC ||
|
||||
aData == STATE_PENDING ||
|
||||
aData == STATE_PENDING_SVC) {
|
||||
// If the update is successfully applied, or if the updater has
|
||||
// fallen back to non-staged updates, go to the finish page.
|
||||
gUpdates.wiz.goTo("finished");
|
||||
} else {
|
||||
gUpdates.wiz.goTo("errors");
|
||||
|
@ -2340,8 +2340,12 @@ UpdateManager.prototype = {
|
||||
getService(Ci.nsIUpdateManager);
|
||||
um.saveUpdates();
|
||||
|
||||
// Destroy the updates directory, since we're done with it.
|
||||
cleanUpUpdatesDir(updateSucceeded);
|
||||
if (update.state != STATE_PENDING && update.state != STATE_PENDING_SVC) {
|
||||
// Destroy the updates directory, since we're done with it.
|
||||
// Make sure to not do this when the updater has fallen back to
|
||||
// non-staged updates.
|
||||
cleanUpUpdatesDir(updateSucceeded);
|
||||
}
|
||||
|
||||
// Send an observer notification which the update wizard uses in
|
||||
// order to update its UI.
|
||||
|
Loading…
Reference in New Issue
Block a user