[tbb-commits] [tor-browser] 02/90: Bug 1769030: Add a configure flag to load policies only from the local policies.json file r=mkaply, glandium
gitolite role
git at cupani.torproject.org
Tue Nov 22 09:57:37 UTC 2022
This is an automated email from the git hooks/post-receive script.
richard pushed a commit to branch tor-browser-102.5.0esr-12.0-1
in repository tor-browser.
commit bea9010507d7e5c50f02753c52c716e5ee787a15
Author: Pier Angelo Vendrame <pierov at torproject.org>
AuthorDate: Tue Aug 16 14:42:20 2022 +0000
Bug 1769030: Add a configure flag to load policies only from the local policies.json file r=mkaply,glandium
Add a configuration flag to make Enterprise Policies mechanism only
consult a policies.json file (avoiding the Windows Registry, macOS's
file system attributes, and /etc/firefox/policies/policies.json on
other OS).
Differential Revision: https://phabricator.services.mozilla.com/D146300
---
.../components/enterprisepolicies/EnterprisePoliciesParent.jsm | 9 ++++++---
toolkit/modules/AppConstants.jsm | 7 +++++++
toolkit/modules/moz.build | 1 +
toolkit/moz.configure | 10 ++++++++++
4 files changed, 24 insertions(+), 3 deletions(-)
diff --git a/toolkit/components/enterprisepolicies/EnterprisePoliciesParent.jsm b/toolkit/components/enterprisepolicies/EnterprisePoliciesParent.jsm
index bfb8c02573f2..1ec347ca3f5d 100644
--- a/toolkit/components/enterprisepolicies/EnterprisePoliciesParent.jsm
+++ b/toolkit/components/enterprisepolicies/EnterprisePoliciesParent.jsm
@@ -140,9 +140,12 @@ EnterprisePoliciesManager.prototype = {
_chooseProvider() {
let platformProvider = null;
- if (AppConstants.platform == "win") {
+ if (AppConstants.platform == "win" && AppConstants.MOZ_SYSTEM_POLICIES) {
platformProvider = new WindowsGPOPoliciesProvider();
- } else if (AppConstants.platform == "macosx") {
+ } else if (
+ AppConstants.platform == "macosx" &&
+ AppConstants.MOZ_SYSTEM_POLICIES
+ ) {
platformProvider = new macOSPoliciesProvider();
}
let jsonProvider = new JSONPoliciesProvider();
@@ -526,7 +529,7 @@ class JSONPoliciesProvider {
_getConfigurationFile() {
let configFile = null;
- if (AppConstants.platform == "linux") {
+ if (AppConstants.platform == "linux" && AppConstants.MOZ_SYSTEM_POLICIES) {
let systemConfigFile = Cc["@mozilla.org/file/local;1"].createInstance(
Ci.nsIFile
);
diff --git a/toolkit/modules/AppConstants.jsm b/toolkit/modules/AppConstants.jsm
index 7f8ac95dd962..5799b78178aa 100644
--- a/toolkit/modules/AppConstants.jsm
+++ b/toolkit/modules/AppConstants.jsm
@@ -453,6 +453,13 @@ this.AppConstants = Object.freeze({
false,
#endif
+ MOZ_SYSTEM_POLICIES:
+#ifdef MOZ_SYSTEM_POLICIES
+ true,
+#else
+ false,
+#endif
+
// Returns true for CN region build when distibution id set as 'MozillaOnline'
isChinaRepack() {
return (
diff --git a/toolkit/modules/moz.build b/toolkit/modules/moz.build
index 26acb92b37b7..f8f65aef789e 100644
--- a/toolkit/modules/moz.build
+++ b/toolkit/modules/moz.build
@@ -292,6 +292,7 @@ for var in (
"MOZ_ALLOW_ADDON_SIDELOAD",
"MOZ_BACKGROUNDTASKS",
"MOZ_SYSTEM_NSS",
+ "MOZ_SYSTEM_POLICIES",
"MOZ_UNSIGNED_APP_SCOPE",
"MOZ_UNSIGNED_SYSTEM_SCOPE",
"MOZ_UPDATE_AGENT",
diff --git a/toolkit/moz.configure b/toolkit/moz.configure
index 0dd52bd5203b..a3dcca690901 100644
--- a/toolkit/moz.configure
+++ b/toolkit/moz.configure
@@ -3210,3 +3210,13 @@ with only_when(compile_environment & depends(target.os)(lambda os: os != "WINNT"
set_define("HAVE_ARC4RANDOM", check_symbol("arc4random"))
set_define("HAVE_ARC4RANDOM_BUF", check_symbol("arc4random_buf"))
set_define("HAVE_MALLINFO", check_symbol("mallinfo"))
+
+# System policies
+# ==============================================================
+
+option(
+ "--disable-system-policies",
+ help="Disable reading policies from Windows registry, macOS's file system attributes, and /etc/firefox",
+)
+
+set_config("MOZ_SYSTEM_POLICIES", True, when="--enable-system-policies")
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the tbb-commits
mailing list