mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 11:25:00 +00:00
Client code - Bug 1358336 - app update tries to install staged updates for older versions. r=mhowell
Adds the startup version check so it is performed for all update types Moves the update cleanup code into nsUpdateService.js
This commit is contained in:
parent
8fc94b03eb
commit
e03471bf82
@ -1841,6 +1841,23 @@ UpdateService.prototype = {
|
||||
return;
|
||||
}
|
||||
|
||||
// Handle the case when the update is the same or older than the current
|
||||
// version and nsUpdateDriver.cpp skipped updating due to the version being
|
||||
// older than the current version.
|
||||
if (update && update.appVersion &&
|
||||
(status == STATE_PENDING || status == STATE_PENDING_SERVICE ||
|
||||
status == STATE_APPLIED || status == STATE_APPLIED_SERVICE ||
|
||||
status == STATE_PENDING_ELEVATE)) {
|
||||
if (Services.vc.compare(update.appVersion, Services.appinfo.version) < 0 ||
|
||||
Services.vc.compare(update.appVersion, Services.appinfo.version) == 0 &&
|
||||
update.buildID == Services.appinfo.appBuildID) {
|
||||
LOG("UpdateService:_postUpdateProcessing - removing update for older " +
|
||||
"or same application version");
|
||||
cleanupActiveUpdate();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (status == STATE_DOWNLOADING) {
|
||||
LOG("UpdateService:_postUpdateProcessing - patch found in downloading " +
|
||||
"state");
|
||||
|
@ -798,6 +798,16 @@ ProcessUpdates(nsIFile *greDir, nsIFile *appDir, nsIFile *updRootDir,
|
||||
return rv;
|
||||
}
|
||||
|
||||
// Return early since there isn't a valid update when the update application
|
||||
// version file doesn't exist or if the update's application version is less
|
||||
// than the current application version. The cleanup of the update will happen
|
||||
// during post update processing in nsUpdateService.js.
|
||||
nsCOMPtr<nsIFile> versionFile;
|
||||
if (!GetVersionFile(updatesDir, versionFile) ||
|
||||
IsOlderVersion(versionFile, appVersion)) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIFile> statusFile;
|
||||
UpdateStatus status = GetUpdateStatus(updatesDir, statusFile);
|
||||
switch (status) {
|
||||
@ -816,16 +826,7 @@ ProcessUpdates(nsIFile *greDir, nsIFile *appDir, nsIFile *updRootDir,
|
||||
}
|
||||
case ePendingUpdate:
|
||||
case ePendingService: {
|
||||
nsCOMPtr<nsIFile> versionFile;
|
||||
// Remove the update if the update application version file doesn't exist
|
||||
// or if the update's application version is less than the current
|
||||
// application version.
|
||||
if (!GetVersionFile(updatesDir, versionFile) ||
|
||||
IsOlderVersion(versionFile, appVersion)) {
|
||||
updatesDir->Remove(true);
|
||||
} else {
|
||||
ApplyUpdate(greDir, updatesDir, appDir, argc, argv, restart, false, pid);
|
||||
}
|
||||
ApplyUpdate(greDir, updatesDir, appDir, argc, argv, restart, false, pid);
|
||||
break;
|
||||
}
|
||||
case eAppliedUpdate:
|
||||
|
Loading…
Reference in New Issue
Block a user