зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1718444 - Don't show the update-available prompt if we aren't going to download the update r=nalexander,application-update-reviewers
This patch fixes an issue where it is possible to show the update-available prompt to the user for an update that will not ultimately be downloaded. This can result in many unnecessary update-available prompts. The issue is that `AUS.downloadUpdate` makes some checks to ensure that it doesn't download updates if, for example, that exact update has already been downloaded. But the update-available prompt is shown before `AUS.downloadUpdate` is called. Depends on D126163 Differential Revision: https://phabricator.services.mozilla.com/D126164
This commit is contained in:
Родитель
65ab371853
Коммит
f52093e006
|
@ -1942,6 +1942,38 @@ function updateIsAtLeastAsOldAs(update, version, buildID) {
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* This returns true if the passed update is the same version or older than
|
||||
* currently installed Firefox version.
|
||||
*/
|
||||
function updateIsAtLeastAsOldAsCurrentVersion(update) {
|
||||
return updateIsAtLeastAsOldAs(
|
||||
update,
|
||||
Services.appinfo.version,
|
||||
Services.appinfo.appBuildID
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* This returns true if the passed update is the same version or older than
|
||||
* the update that we have already downloaded (UpdateManager.readyUpdate).
|
||||
* Returns false if no update has already been downloaded.
|
||||
*/
|
||||
function updateIsAtLeastAsOldAsReadyUpdate(update) {
|
||||
if (
|
||||
!UM.readyUpdate ||
|
||||
!UM.readyUpdate.appVersion ||
|
||||
!UM.readyUpdate.buildID
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
return updateIsAtLeastAsOldAs(
|
||||
update,
|
||||
UM.readyUpdate.appVersion,
|
||||
UM.readyUpdate.buildID
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update Patch
|
||||
* @param patch
|
||||
|
@ -3429,20 +3461,35 @@ UpdateService.prototype = {
|
|||
updates.forEach(function(aUpdate) {
|
||||
// Ignore updates for older versions of the application and updates for
|
||||
// the same version of the application with the same build ID.
|
||||
if (
|
||||
vc.compare(aUpdate.appVersion, Services.appinfo.version) < 0 ||
|
||||
(vc.compare(aUpdate.appVersion, Services.appinfo.version) == 0 &&
|
||||
aUpdate.buildID == Services.appinfo.appBuildID)
|
||||
) {
|
||||
if (updateIsAtLeastAsOldAsCurrentVersion(aUpdate)) {
|
||||
LOG(
|
||||
"UpdateService:selectUpdate - skipping update because the " +
|
||||
"update's application version is less than the current " +
|
||||
"update's application version is not greater than the current " +
|
||||
"application version"
|
||||
);
|
||||
lastCheckCode = AUSTLMY.CHK_UPDATE_PREVIOUS_VERSION;
|
||||
return;
|
||||
}
|
||||
|
||||
if (updateIsAtLeastAsOldAsReadyUpdate(aUpdate)) {
|
||||
LOG(
|
||||
"UpdateService:selectUpdate - skipping update because the " +
|
||||
"update's application version is not greater than that of the " +
|
||||
"currently downloaded update"
|
||||
);
|
||||
lastCheckCode = AUSTLMY.CHK_UPDATE_PREVIOUS_VERSION;
|
||||
return;
|
||||
}
|
||||
|
||||
if (UM.readyUpdate && !getPatchOfType(aUpdate, "partial")) {
|
||||
LOG(
|
||||
"UpdateService:selectUpdate - skipping update because no partial " +
|
||||
"patch is available and an update has already been downloaded."
|
||||
);
|
||||
lastCheckCode = AUSTLMY.CHK_NO_PARTIAL_PATCH;
|
||||
return;
|
||||
}
|
||||
|
||||
switch (aUpdate.type) {
|
||||
case "major":
|
||||
if (!majorUpdate) {
|
||||
|
@ -3893,13 +3940,7 @@ UpdateService.prototype = {
|
|||
// build ID. If we already have an update ready, we want to apply those
|
||||
// same checks against the version of the ready update, so that we don't
|
||||
// download an update that isn't newer than the one we already have.
|
||||
if (
|
||||
updateIsAtLeastAsOldAs(
|
||||
update,
|
||||
Services.appinfo.version,
|
||||
Services.appinfo.appBuildID
|
||||
)
|
||||
) {
|
||||
if (updateIsAtLeastAsOldAsCurrentVersion(update)) {
|
||||
LOG(
|
||||
"UpdateService:downloadUpdate - canceling download of update since " +
|
||||
"it is for an earlier or same application version and build ID.\n" +
|
||||
|
@ -3918,16 +3959,7 @@ UpdateService.prototype = {
|
|||
cleanupDownloadingUpdate();
|
||||
return false;
|
||||
}
|
||||
if (
|
||||
UM.readyUpdate &&
|
||||
UM.readyUpdate.appVersion &&
|
||||
UM.readyUpdate.buildID &&
|
||||
updateIsAtLeastAsOldAs(
|
||||
update,
|
||||
UM.readyUpdate.appVersion,
|
||||
UM.readyUpdate.buildID
|
||||
)
|
||||
) {
|
||||
if (updateIsAtLeastAsOldAsReadyUpdate(update)) {
|
||||
LOG(
|
||||
"UpdateService:downloadUpdate - not downloading update because the " +
|
||||
"update that's already been downloaded is the same version or " +
|
||||
|
|
|
@ -101,6 +101,9 @@ var AUSTLMY = {
|
|||
// Update check was delayed because another instance of the application is
|
||||
// currently running
|
||||
CHK_OTHER_INSTANCE: 39,
|
||||
// Cannot yet download update because no partial patch is available and an
|
||||
// update has already been downloaded.
|
||||
CHK_NO_PARTIAL_PATCH: 40,
|
||||
|
||||
/**
|
||||
* Submit a telemetry ping for the update check result code or a telemetry
|
||||
|
|
Загрузка…
Ссылка в новой задаче