summaryrefslogtreecommitdiffstats
path: root/browser/components/enterprisepolicies
diff options
context:
space:
mode:
Diffstat (limited to 'browser/components/enterprisepolicies')
-rw-r--r--browser/components/enterprisepolicies/Policies.sys.mjs71
-rw-r--r--browser/components/enterprisepolicies/content/aboutPolicies.js12
-rw-r--r--browser/components/enterprisepolicies/helpers/BookmarksPolicies.sys.mjs4
-rw-r--r--browser/components/enterprisepolicies/helpers/ProxyPolicies.sys.mjs2
-rw-r--r--browser/components/enterprisepolicies/schemas/policies-schema.json38
-rw-r--r--browser/components/enterprisepolicies/tests/browser/browser_policy_allowfileselectiondialogs.js2
-rw-r--r--browser/components/enterprisepolicies/tests/xpcshell/test_policy_search_engine.js2
-rw-r--r--browser/components/enterprisepolicies/tests/xpcshell/test_simple_pref_policies.js13
8 files changed, 126 insertions, 18 deletions
diff --git a/browser/components/enterprisepolicies/Policies.sys.mjs b/browser/components/enterprisepolicies/Policies.sys.mjs
index 24f2f9d516..41fc89957c 100644
--- a/browser/components/enterprisepolicies/Policies.sys.mjs
+++ b/browser/components/enterprisepolicies/Policies.sys.mjs
@@ -43,7 +43,7 @@ ChromeUtils.defineLazyGetter(lazy, "log", () => {
"resource://gre/modules/Console.sys.mjs"
);
return new ConsoleAPI({
- prefix: "Policies.jsm",
+ prefix: "Policies",
// tip: set maxLogLevel to "debug" and use log.debug() to create detailed
// messages during development. See LOG_LEVELS in Console.sys.mjs for details.
maxLogLevel: "error",
@@ -233,12 +233,12 @@ export var Policies = {
return true;
},
- // No additional implementation needed here. UpdateService.jsm will check
+ // No additional implementation needed here. UpdateService.sys.mjs will check
// for this policy directly when determining the update URL.
},
AppUpdateURL: {
- // No implementation needed here. UpdateService.jsm will check for this
+ // No implementation needed here. UpdateService.sys.mjs will check for this
// policy directly when determining the update URL.
},
@@ -313,6 +313,18 @@ export var Policies = {
},
},
+ AutofillAddressEnabled: {
+ onBeforeAddons(manager, param) {
+ setAndLockPref("extensions.formautofill.addresses.enabled", param);
+ },
+ },
+
+ AutofillCreditCardEnabled: {
+ onBeforeAddons(manager, param) {
+ setAndLockPref("extensions.formautofill.creditCards.enabled", param);
+ },
+ },
+
AutoLaunchProtocolsFromOrigins: {
onBeforeAddons(manager, param) {
for (let info of param) {
@@ -497,10 +509,57 @@ export var Policies = {
},
ContentAnalysis: {
- onBeforeUIStartup(manager, param) {
+ onBeforeAddons(manager, param) {
+ if ("PipePathName" in param) {
+ setAndLockPref(
+ "browser.contentanalysis.pipe_path_name",
+ param.PipePathName
+ );
+ }
+ if ("AgentTimeout" in param) {
+ if (!Number.isInteger(param.AgentTimeout)) {
+ lazy.log.error(
+ `Non-integer value for AgentTimeout: ${param.AgentTimeout}`
+ );
+ } else {
+ setAndLockPref(
+ "browser.contentanalysis.agent_timeout",
+ param.AgentTimeout
+ );
+ }
+ }
+ if ("AllowUrlRegexList" in param) {
+ setAndLockPref(
+ "browser.contentanalysis.allow_url_regex_list",
+ param.AllowUrlRegexList
+ );
+ }
+ if ("DenyUrlRegexList" in param) {
+ setAndLockPref(
+ "browser.contentanalysis.deny_url_regex_list",
+ param.DenyUrlRegexList
+ );
+ }
+ let boolPrefs = [
+ ["IsPerUser", "is_per_user"],
+ ["ShowBlockedResult", "show_blocked_result"],
+ ["DefaultAllow", "default_allow"],
+ ];
+ for (let pref of boolPrefs) {
+ if (pref[0] in param) {
+ setAndLockPref(
+ `browser.contentanalysis.${pref[1]}`,
+ !!param[pref[0]]
+ );
+ }
+ }
if ("Enabled" in param) {
let enabled = !!param.Enabled;
setAndLockPref("browser.contentanalysis.enabled", enabled);
+ let ca = Cc["@mozilla.org/contentanalysis;1"].getService(
+ Ci.nsIContentAnalysis
+ );
+ ca.isSetByEnterprisePolicy = true;
}
},
},
@@ -618,8 +677,6 @@ export var Policies = {
"browser.download.dir",
replacePathVariables(param)
);
- // If a custom download directory is being used, just lock folder list to 2.
- setAndLockPref("browser.download.folderList", 2);
},
},
@@ -1061,7 +1118,7 @@ export var Policies = {
},
ExemptDomainFileTypePairsFromFileTypeDownloadWarnings: {
- // This policy is handled directly in EnterprisePoliciesParent.jsm
+ // This policy is handled directly in EnterprisePoliciesParent.sys.mjs
// and requires no validation (It's done by the schema).
},
diff --git a/browser/components/enterprisepolicies/content/aboutPolicies.js b/browser/components/enterprisepolicies/content/aboutPolicies.js
index 39b4fc067c..9cde085f3d 100644
--- a/browser/components/enterprisepolicies/content/aboutPolicies.js
+++ b/browser/components/enterprisepolicies/content/aboutPolicies.js
@@ -249,14 +249,14 @@ function generateErrors() {
const consoleEvents = storage.getEvents();
const prefixes = [
"Enterprise Policies",
- "JsonSchemaValidator.jsm",
- "Policies.jsm",
- "GPOParser.jsm",
+ "JsonSchemaValidator",
+ "Policies",
+ "WindowsGPOParser",
"Enterprise Policies Child",
- "BookmarksPolicies.jsm",
- "ProxyPolicies.jsm",
+ "BookmarksPolicies",
+ "ProxyPolicies",
"WebsiteFilter Policy",
- "macOSPoliciesParser.jsm",
+ "macOSPoliciesParser",
];
let new_cont = document.getElementById("errorsContent");
diff --git a/browser/components/enterprisepolicies/helpers/BookmarksPolicies.sys.mjs b/browser/components/enterprisepolicies/helpers/BookmarksPolicies.sys.mjs
index 616df38291..5fc70c31cf 100644
--- a/browser/components/enterprisepolicies/helpers/BookmarksPolicies.sys.mjs
+++ b/browser/components/enterprisepolicies/helpers/BookmarksPolicies.sys.mjs
@@ -50,9 +50,9 @@ ChromeUtils.defineLazyGetter(lazy, "log", () => {
"resource://gre/modules/Console.sys.mjs"
);
return new ConsoleAPI({
- prefix: "BookmarksPolicies.jsm",
+ prefix: "BookmarksPolicies",
// tip: set maxLogLevel to "debug" and use log.debug() to create detailed
- // messages during development. See LOG_LEVELS in Console.jsm for details.
+ // messages during development. See LOG_LEVELS in Console.sys.mjs for details.
maxLogLevel: "error",
maxLogLevelPref: PREF_LOGLEVEL,
});
diff --git a/browser/components/enterprisepolicies/helpers/ProxyPolicies.sys.mjs b/browser/components/enterprisepolicies/helpers/ProxyPolicies.sys.mjs
index 17c7806c50..393b9bb85e 100644
--- a/browser/components/enterprisepolicies/helpers/ProxyPolicies.sys.mjs
+++ b/browser/components/enterprisepolicies/helpers/ProxyPolicies.sys.mjs
@@ -11,7 +11,7 @@ ChromeUtils.defineLazyGetter(lazy, "log", () => {
"resource://gre/modules/Console.sys.mjs"
);
return new ConsoleAPI({
- prefix: "ProxyPolicies.jsm",
+ prefix: "ProxyPolicies",
// tip: set maxLogLevel to "debug" and use log.debug() to create detailed
// messages during development. See LOG_LEVELS in Console.sys.mjs for details.
maxLogLevel: "error",
diff --git a/browser/components/enterprisepolicies/schemas/policies-schema.json b/browser/components/enterprisepolicies/schemas/policies-schema.json
index cfb04e841f..a1ccaed74f 100644
--- a/browser/components/enterprisepolicies/schemas/policies-schema.json
+++ b/browser/components/enterprisepolicies/schemas/policies-schema.json
@@ -90,6 +90,14 @@
}
},
+ "AutofillAddressEnabled": {
+ "type": "boolean"
+ },
+
+ "AutofillCreditCardEnabled": {
+ "type": "boolean"
+ },
+
"AutoLaunchProtocolsFromOrigins": {
"type": ["array", "JSON"],
"items": {
@@ -227,6 +235,36 @@
}
},
+ "ContentAnalysis": {
+ "type": "object",
+ "properties": {
+ "Enabled": {
+ "type": "boolean"
+ },
+ "PipePathName": {
+ "type": "string"
+ },
+ "AgentTimeout": {
+ "type": "number"
+ },
+ "AllowUrlRegexList": {
+ "type": "string"
+ },
+ "DenyUrlRegexList": {
+ "type": "string"
+ },
+ "IsPerUser": {
+ "type": "boolean"
+ },
+ "ShowBlockedResult": {
+ "type": "boolean"
+ },
+ "DefaultAllow": {
+ "type": "boolean"
+ }
+ }
+ },
+
"Cookies": {
"type": "object",
"properties": {
diff --git a/browser/components/enterprisepolicies/tests/browser/browser_policy_allowfileselectiondialogs.js b/browser/components/enterprisepolicies/tests/browser/browser_policy_allowfileselectiondialogs.js
index 94f6bba631..4ba4a7cf25 100644
--- a/browser/components/enterprisepolicies/tests/browser/browser_policy_allowfileselectiondialogs.js
+++ b/browser/components/enterprisepolicies/tests/browser/browser_policy_allowfileselectiondialogs.js
@@ -154,7 +154,7 @@ add_task(async function test_cancel_event() {
add_task(async function test_nsIFilePicker_open() {
let picker = Cc["@mozilla.org/filepicker;1"].createInstance(Ci.nsIFilePicker);
- picker.init(window, "", Ci.nsIFilePicker.modeSave);
+ picker.init(window.browsingContext, "", Ci.nsIFilePicker.modeSave);
let result = await new Promise(resolve => picker.open(res => resolve(res)));
diff --git a/browser/components/enterprisepolicies/tests/xpcshell/test_policy_search_engine.js b/browser/components/enterprisepolicies/tests/xpcshell/test_policy_search_engine.js
index 5c602442f2..c8eb29982d 100644
--- a/browser/components/enterprisepolicies/tests/xpcshell/test_policy_search_engine.js
+++ b/browser/components/enterprisepolicies/tests/xpcshell/test_policy_search_engine.js
@@ -189,7 +189,7 @@ add_task(async function test_install_and_remove() {
Assert.notEqual(engine, null, "Specified search engine should be installed");
Assert.equal(
- engine.wrappedJSObject.getIconURL(),
+ await engine.wrappedJSObject.getIconURL(),
iconURL,
"Icon should be present"
);
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 8ef8b831ef..82caee16a7 100644
--- a/browser/components/enterprisepolicies/tests/xpcshell/test_simple_pref_policies.js
+++ b/browser/components/enterprisepolicies/tests/xpcshell/test_simple_pref_policies.js
@@ -1032,6 +1032,19 @@ const POLICIES_TESTS = [
"browser.newtabpage.activity-stream.asrouter.userprefs.cfr.features": true,
},
},
+
+ // POLICY: AutofillAddressEnabled, AutofillCreditCardEnabled
+
+ {
+ policies: {
+ AutofillAddressEnabled: false,
+ AutofillCreditCardEnabled: false,
+ },
+ lockedPrefs: {
+ "extensions.formautofill.addresses.enabled": false,
+ "extensions.formautofill.creditCards.enabled": false,
+ },
+ },
];
add_task(async function test_policy_simple_prefs() {