Bug 1710796 - Don't show URL bar update hints if update is disabled. r=emalysz,mhowell

Differential Revision: https://phabricator.services.mozilla.com/D115245
This commit is contained in:
Mike Kaply 2021-05-27 22:32:22 +00:00
parent 667a7f0bb0
commit 5dc5d0b0c7
2 changed files with 28 additions and 0 deletions

View File

@ -2,6 +2,11 @@
* http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
XPCOMUtils.defineLazyModuleGetters(this, {
UrlbarTestUtils: "resource://testing-common/UrlbarTestUtils.jsm",
});
var updateService = Cc["@mozilla.org/updates/update-service;1"].getService(
Ci.nsIApplicationUpdateService
);
@ -90,3 +95,20 @@ function waitForAboutDialog() {
openAboutDialog();
});
}
add_task(async function test_no_update_intervention() {
await BrowserTestUtils.withNewTab("about:blank", async () => {
let context = await UrlbarTestUtils.promiseAutocompleteResultPopup({
window,
value: "update firefox",
waitForFocus,
fireInputEvent: true,
});
for (let result of context.results) {
Assert.notEqual(result.type, UrlbarUtils.RESULT_TYPE.TIP);
}
await UrlbarTestUtils.promisePopupClose(window, () =>
window.gURLBar.blur()
);
});
});

View File

@ -567,6 +567,12 @@ class ProviderInterventions extends UrlbarProvider {
// how this special tip is handled.
this.currentTip = TIPS.UPDATE_CHECKING;
break;
case AppUpdater.STATUS.NO_UPDATER:
case AppUpdater.STATUS.UPDATE_DISABLED_BY_POLICY:
// If the updater is disabled at build time or at runtime, either by
// policy or because we're in a package, do not select any update tips.
this.currentTip = TIPS.NONE;
break;
default:
// Give up and ask the user to download the latest version from the
// web. We default to this case when the update is still downloading