зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1621423 - Allow adding webextension restricted domains via policy. r=mixedpuppy
Differential Revision: https://phabricator.services.mozilla.com/D74304
This commit is contained in:
Родитель
9f699a4611
Коммит
990a4a43ce
|
@ -855,6 +855,17 @@ var Policies = {
|
|||
// Block about:debugging
|
||||
blockAboutPage(manager, "about:debugging");
|
||||
}
|
||||
if ("restricted_domains" in extensionSettings["*"]) {
|
||||
let restrictedDomains = Services.prefs
|
||||
.getCharPref("extensions.webextensions.restrictedDomains")
|
||||
.split(",");
|
||||
setAndLockPref(
|
||||
"extensions.webextensions.restrictedDomains",
|
||||
restrictedDomains
|
||||
.concat(extensionSettings["*"].restricted_domains)
|
||||
.join(",")
|
||||
);
|
||||
}
|
||||
}
|
||||
let addons = await AddonManager.getAllAddons();
|
||||
let allowedExtensions = [];
|
||||
|
|
|
@ -437,6 +437,12 @@
|
|||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"restricted_domains": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -202,3 +202,20 @@ add_task(async function test_extensionsettings_string() {
|
|||
let extensionSettings = Services.policies.getExtensionSettings("*");
|
||||
equal(extensionSettings.installation_mode, "blocked");
|
||||
});
|
||||
|
||||
add_task(async function test_extensionsettings_string() {
|
||||
let restrictedDomains = Services.prefs.getCharPref(
|
||||
"extensions.webextensions.restrictedDomains"
|
||||
);
|
||||
await setupPolicyEngineWithJson({
|
||||
policies: {
|
||||
ExtensionSettings:
|
||||
'{"*": {"restricted_domains": ["example.com","example.org"]}}',
|
||||
},
|
||||
});
|
||||
|
||||
let newRestrictedDomains = Services.prefs.getCharPref(
|
||||
"extensions.webextensions.restrictedDomains"
|
||||
);
|
||||
equal(newRestrictedDomains, restrictedDomains + ",example.com,example.org");
|
||||
});
|
||||
|
|
Загрузка…
Ссылка в новой задаче