From 724b36b7051c0d9190cbd8854ba5919904967c11 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Tue, 21 May 2024 07:22:11 +0200 Subject: Merging upstream version 115.11.0esr. Signed-off-by: Daniel Baumann --- .../components/enterprisepolicies/Policies.sys.mjs | 12 +++++------ .../helpers/ProxyPolicies.sys.mjs | 24 ++++++++++++++++++++++ .../tests/xpcshell/test_simple_pref_policies.js | 12 +++++++++++ 3 files changed, 42 insertions(+), 6 deletions(-) (limited to 'browser/components/enterprisepolicies') diff --git a/browser/components/enterprisepolicies/Policies.sys.mjs b/browser/components/enterprisepolicies/Policies.sys.mjs index 8ad1349441..858c5ba7dc 100644 --- a/browser/components/enterprisepolicies/Policies.sys.mjs +++ b/browser/components/enterprisepolicies/Policies.sys.mjs @@ -1725,6 +1725,8 @@ export var Policies = { "places.", "pref.", "print.", + "privacy.userContext.enabled", + "privacy.userContext.ui.enabled", "signon.", "spellchecker.", "toolkit.legacyUserProfileCustomizations.stylesheets", @@ -1904,13 +1906,11 @@ export var Policies = { onBeforeAddons(manager, param) { if (param.Locked) { manager.disallowFeature("changeProxySettings"); - lazy.ProxyPolicies.configureProxySettings(param, setAndLockPref); - } else { - lazy.ProxyPolicies.configureProxySettings( - param, - PoliciesUtils.setDefaultPref - ); } + lazy.ProxyPolicies.configureProxySettings( + param, + PoliciesUtils.setDefaultPref + ); }, }, diff --git a/browser/components/enterprisepolicies/helpers/ProxyPolicies.sys.mjs b/browser/components/enterprisepolicies/helpers/ProxyPolicies.sys.mjs index 8f2ba0b2a2..148984a055 100644 --- a/browser/components/enterprisepolicies/helpers/ProxyPolicies.sys.mjs +++ b/browser/components/enterprisepolicies/helpers/ProxyPolicies.sys.mjs @@ -31,6 +31,22 @@ export var PROXY_TYPES_MAP = new Map([ ["autoConfig", Ci.nsIProtocolProxyService.PROXYCONFIG_PAC], ]); +let proxyPreferences = [ + "network.proxy.type", + "network.proxy.autoconfig_url", + "network.proxy.socks_remote_dns", + "signon.autologin.proxy", + "network.proxy.socks_version", + "network.proxy.no_proxies_on", + "network.proxy.share_proxy_settings", + "network.proxy.http", + "network.proxy.http_port", + "network.proxy.ssl", + "network.proxy.ssl_port", + "network.proxy.socks", + "network.proxy.socks_port", +]; + export var ProxyPolicies = { configureProxySettings(param, setPref) { if (param.Mode) { @@ -107,5 +123,13 @@ export var ProxyPolicies = { if (param.SOCKSProxy) { setProxyHostAndPort("socks", param.SOCKSProxy); } + + // All preferences should be locked regardless of whether or not a + // specific value was set. + if (param.Locked) { + for (let preference of proxyPreferences) { + Services.prefs.lockPref(preference); + } + } }, }; diff --git a/browser/components/enterprisepolicies/tests/xpcshell/test_simple_pref_policies.js b/browser/components/enterprisepolicies/tests/xpcshell/test_simple_pref_policies.js index 0a8d77d483..1468fcd46c 100644 --- a/browser/components/enterprisepolicies/tests/xpcshell/test_simple_pref_policies.js +++ b/browser/components/enterprisepolicies/tests/xpcshell/test_simple_pref_policies.js @@ -1034,6 +1034,18 @@ const POLICIES_TESTS = [ "extensions.formautofill.creditCards.enabled": false, }, }, + + // POLICY: Proxy - locking if no values are set + { + policies: { + Proxy: { + Locked: true, + }, + }, + lockedPrefs: { + "network.proxy.type": 5, + }, + }, ]; add_task(async function test_policy_simple_prefs() { -- cgit v1.2.3