Main patch for Bug 774618 - Partner builds don't download complete update if partial fails, or show workaround information if complete fails. r=bbondy

This commit is contained in:
Robert Strong 2012-10-19 12:42:55 -07:00
parent a4522c28ee
commit 436f08c09e

View File

@ -1033,7 +1033,7 @@ function handleFallbackToCompleteUpdate(update, postStaging) {
if (update.selectedPatch && oldType == "partial" && update.patchCount == 2) { if (update.selectedPatch && oldType == "partial" && update.patchCount == 2) {
// Partial patch application failed, try downloading the complete // Partial patch application failed, try downloading the complete
// update in the background instead. // update in the background instead.
LOG("UpdateService:_postUpdateProcessing - install of partial patch " + LOG("handleFallbackToCompleteUpdate - install of partial patch " +
"failed, downloading complete patch"); "failed, downloading complete patch");
var status = Cc["@mozilla.org/updates/update-service;1"]. var status = Cc["@mozilla.org/updates/update-service;1"].
getService(Ci.nsIApplicationUpdateService). getService(Ci.nsIApplicationUpdateService).
@ -1628,8 +1628,15 @@ UpdateService.prototype = {
} }
#endif #endif
if (!update) if (!update) {
if (status != STATE_SUCCEEDED) {
LOG("UpdateService:_postUpdateProcessing - previous patch failed " +
"and no patch available");
cleanupActiveUpdate();
return;
}
update = new Update(null); update = new Update(null);
}
var prompter = Cc["@mozilla.org/updates/update-prompt;1"]. var prompter = Cc["@mozilla.org/updates/update-prompt;1"].
createInstance(Ci.nsIUpdatePrompt); createInstance(Ci.nsIUpdatePrompt);
@ -2490,13 +2497,21 @@ UpdateManager.prototype = {
get activeUpdate() { get activeUpdate() {
if (this._activeUpdate && if (this._activeUpdate &&
this._activeUpdate.channel != UpdateChannel.get()) { this._activeUpdate.channel != UpdateChannel.get()) {
// User switched channels, clear out any old active updates and remove LOG("UpdateManager:get activeUpdate - channel has changed, " +
// partial downloads "reloading default preferences to workaround bug 802022");
this._activeUpdate = null; // Workaround to get distribution preferences loaded (Bug 774618). This
this.saveUpdates(); // can be removed after bug 802022 is fixed.
let prefSvc = Services.prefs.QueryInterface(Ci.nsIObserver);
prefSvc.observe(null, "reload-default-prefs", null);
if (this._activeUpdate.channel != UpdateChannel.get()) {
// User switched channels, clear out any old active updates and remove
// partial downloads
this._activeUpdate = null;
this.saveUpdates();
// Destroy the updates directory, since we're done with it. // Destroy the updates directory, since we're done with it.
cleanUpUpdatesDir(); cleanUpUpdatesDir();
}
} }
return this._activeUpdate; return this._activeUpdate;
}, },