Bug 1568994 - Convert Enterprise policy AppUpdateURL to work with the new update url mechanism r=mkaply,mhowell

Differential Revision: https://phabricator.services.mozilla.com/D45869

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Kirk Steuber 2020-03-24 22:03:27 +00:00
parent b7a4f22235
commit 2b3d684f4e
3 changed files with 15 additions and 7 deletions

View File

@ -90,9 +90,8 @@ var Policies = {
},
AppUpdateURL: {
onBeforeAddons(manager, param) {
setDefaultPref("app.update.url", param.href);
},
// No implementation needed here. UpdateService.jsm will check for this
// policy directly when determining the update URL.
},
Authentication: {

View File

@ -3,6 +3,10 @@
"use strict";
let { Checker } = ChromeUtils.import(
"resource://gre/modules/UpdateService.jsm"
);
add_task(async function test_app_update_URL() {
await setupPolicyEngineWithJson({
policies: {
@ -16,10 +20,8 @@ add_task(async function test_app_update_URL() {
"Engine is active"
);
// The app.update.url preference is read from the default preferences.
let expected = Services.prefs
.getDefaultBranch(null)
.getCharPref("app.update.url", undefined);
let checker = new Checker();
let expected = await checker.getUpdateURL();
equal("https://www.example.com/", expected, "Correct app update URL");
});

View File

@ -3863,6 +3863,13 @@ Checker.prototype = {
let url = Services.appinfo.updateURL;
if (Services.policies) {
let policies = Services.policies.getActivePolicies();
if (policies && "AppUpdateURL" in policies) {
url = policies.AppUpdateURL.toString();
}
}
if (!url) {
LOG("Checker:getUpdateURL - update URL not defined");
return null;