Commit cf146120 authored by Pier Angelo Vendrame's avatar Pier Angelo Vendrame 🎃 Committed by Richard Pospesel
Browse files

Bug 1769030: Add a configure flag to load policies only from the local...

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
parent a7b99304
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -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
      );
+7 −0
Original line number Diff line number Diff line
@@ -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 (
+1 −0
Original line number Diff line number Diff line
@@ -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",
+10 −0
Original line number Diff line number Diff line
@@ -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")