зеркало из 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
|
* Update Patch
|
||||||
* @param patch
|
* @param patch
|
||||||
|
@ -3429,20 +3461,35 @@ UpdateService.prototype = {
|
||||||
updates.forEach(function(aUpdate) {
|
updates.forEach(function(aUpdate) {
|
||||||
// Ignore updates for older versions of the application and updates for
|
// Ignore updates for older versions of the application and updates for
|
||||||
// the same version of the application with the same build ID.
|
// the same version of the application with the same build ID.
|
||||||
if (
|
if (updateIsAtLeastAsOldAsCurrentVersion(aUpdate)) {
|
||||||
vc.compare(aUpdate.appVersion, Services.appinfo.version) < 0 ||
|
|
||||||
(vc.compare(aUpdate.appVersion, Services.appinfo.version) == 0 &&
|
|
||||||
aUpdate.buildID == Services.appinfo.appBuildID)
|
|
||||||
) {
|
|
||||||
LOG(
|
LOG(
|
||||||
"UpdateService:selectUpdate - skipping update because the " +
|
"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"
|
"application version"
|
||||||
);
|
);
|
||||||
lastCheckCode = AUSTLMY.CHK_UPDATE_PREVIOUS_VERSION;
|
lastCheckCode = AUSTLMY.CHK_UPDATE_PREVIOUS_VERSION;
|
||||||
return;
|
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) {
|
switch (aUpdate.type) {
|
||||||
case "major":
|
case "major":
|
||||||
if (!majorUpdate) {
|
if (!majorUpdate) {
|
||||||
|
@ -3893,13 +3940,7 @@ UpdateService.prototype = {
|
||||||
// build ID. If we already have an update ready, we want to apply those
|
// 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
|
// 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.
|
// download an update that isn't newer than the one we already have.
|
||||||
if (
|
if (updateIsAtLeastAsOldAsCurrentVersion(update)) {
|
||||||
updateIsAtLeastAsOldAs(
|
|
||||||
update,
|
|
||||||
Services.appinfo.version,
|
|
||||||
Services.appinfo.appBuildID
|
|
||||||
)
|
|
||||||
) {
|
|
||||||
LOG(
|
LOG(
|
||||||
"UpdateService:downloadUpdate - canceling download of update since " +
|
"UpdateService:downloadUpdate - canceling download of update since " +
|
||||||
"it is for an earlier or same application version and build ID.\n" +
|
"it is for an earlier or same application version and build ID.\n" +
|
||||||
|
@ -3918,16 +3959,7 @@ UpdateService.prototype = {
|
||||||
cleanupDownloadingUpdate();
|
cleanupDownloadingUpdate();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (
|
if (updateIsAtLeastAsOldAsReadyUpdate(update)) {
|
||||||
UM.readyUpdate &&
|
|
||||||
UM.readyUpdate.appVersion &&
|
|
||||||
UM.readyUpdate.buildID &&
|
|
||||||
updateIsAtLeastAsOldAs(
|
|
||||||
update,
|
|
||||||
UM.readyUpdate.appVersion,
|
|
||||||
UM.readyUpdate.buildID
|
|
||||||
)
|
|
||||||
) {
|
|
||||||
LOG(
|
LOG(
|
||||||
"UpdateService:downloadUpdate - not downloading update because the " +
|
"UpdateService:downloadUpdate - not downloading update because the " +
|
||||||
"update that's already been downloaded is the same version or " +
|
"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
|
// Update check was delayed because another instance of the application is
|
||||||
// currently running
|
// currently running
|
||||||
CHK_OTHER_INSTANCE: 39,
|
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
|
* Submit a telemetry ping for the update check result code or a telemetry
|
||||||
|
|
Загрузка…
Ссылка в новой задаче