Commit a032a45a authored by Magnus Melin's avatar Magnus Melin
Browse files

Bug 1482809 - Move non-browser-specific parts of...

Bug 1482809 - Move non-browser-specific parts of browser/components/enterprisepolicies to toolkit r=mkaply,Felipe

Differential Revision: https://phabricator.services.mozilla.com/D28309

--HG--
rename : browser/components/enterprisepolicies/EnterprisePolicies.js => toolkit/components/enterprisepolicies/EnterprisePolicies.js
rename : browser/components/enterprisepolicies/EnterprisePolicies.manifest => toolkit/components/enterprisepolicies/EnterprisePolicies.manifest
rename : browser/components/enterprisepolicies/EnterprisePoliciesContent.js => toolkit/components/enterprisepolicies/EnterprisePoliciesContent.js
rename : browser/components/enterprisepolicies/WindowsGPOParser.jsm => toolkit/components/enterprisepolicies/WindowsGPOParser.jsm
rename : browser/components/enterprisepolicies/macOSPoliciesParser.jsm => toolkit/components/enterprisepolicies/macOSPoliciesParser.jsm
rename : browser/components/enterprisepolicies/tests/EnterprisePolicyTesting.jsm => toolkit/components/enterprisepolicies/tests/EnterprisePolicyTesting.jsm
rename : browser/components/enterprisepolicies/tests/browser/browser_policies_basic_tests.js => toolkit/components/enterprisepolicies/tests/browser/browser_policies_basic_tests.js
rename : browser/components/enterprisepolicies/tests/browser/browser_policies_broken_json.js => toolkit/components/enterprisepolicies/tests/browser/browser_policies_broken_json.js
rename : browser/components/enterprisepolicies/tests/browser/browser_policies_enterprise_only.js => toolkit/components/enterprisepolicies/tests/browser/browser_policies_enterprise_only.js
rename : browser/components/enterprisepolicies/tests/browser/browser_policies_mistyped_json.js => toolkit/components/enterprisepolicies/tests/browser/browser_policies_mistyped_json.js
rename : browser/components/enterprisepolicies/tests/browser/config_broken_json.json => toolkit/components/enterprisepolicies/tests/browser/config_broken_json.json
extra : moz-landing-system : lando
parent 8ca66379
......@@ -16,26 +16,10 @@ TEST_DIRS += [
'tests'
]
EXTRA_COMPONENTS += [
'EnterprisePolicies.js',
'EnterprisePolicies.manifest',
'EnterprisePoliciesContent.js',
]
EXTRA_JS_MODULES.policies += [
'Policies.jsm',
]
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows':
EXTRA_JS_MODULES.policies += [
'WindowsGPOParser.jsm',
]
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa':
EXTRA_JS_MODULES.policies += [
'macOSPoliciesParser.jsm',
]
FINAL_LIBRARY = 'browsercomps'
JAR_MANIFESTS += ['jar.mn']
......@@ -2,7 +2,6 @@
support-files =
head.js
config_popups_cookies_addons_flash.json
config_broken_json.json
opensearch.html
opensearchEngine.xml
policytest_v0.1.xpi
......@@ -12,13 +11,9 @@ support-files =
../../../../../toolkit/components/antitracking/test/browser/page.html
../../../../../toolkit/components/antitracking/test/browser/subResources.sjs
[browser_policies_basic_tests.js]
[browser_policies_broken_json.js]
[browser_policies_enterprise_only.js]
[browser_policies_getActivePolicies.js]
[browser_policies_macosparser_unflatten.js]
skip-if = os != 'mac'
[browser_policies_mistyped_json.js]
[browser_policies_notice_in_aboutpreferences.js]
[browser_policies_popups_cookies_addons_flash.js]
[browser_policies_runOnce_helper.js]
......
......@@ -3,7 +3,7 @@
"use strict";
let { macOSPoliciesParser } = ChromeUtils.import("resource:///modules/policies/macOSPoliciesParser.jsm");
let { macOSPoliciesParser } = ChromeUtils.import("resource://gre/modules/policies/macOSPoliciesParser.jsm");
add_task(async function test_object_unflatten() {
// Note: these policies are just examples and they won't actually
......
......@@ -13,7 +13,3 @@ BROWSER_CHROME_MANIFESTS += [
'browser/disable_fxscreenshots/browser.ini',
'browser/hardware_acceleration/browser.ini',
]
TESTING_JS_MODULES += [
'EnterprisePolicyTesting.jsm',
]
......@@ -165,9 +165,9 @@
; JavaScript components
@RESPATH@/browser/components/BrowserComponents.manifest
@RESPATH@/browser/components/EnterprisePolicies.js
@RESPATH@/browser/components/EnterprisePoliciesContent.js
@RESPATH@/browser/components/EnterprisePolicies.manifest
@RESPATH@/components/EnterprisePolicies.js
@RESPATH@/components/EnterprisePoliciesContent.js
@RESPATH@/components/EnterprisePolicies.manifest
@RESPATH@/components/toolkitsearch.manifest
@RESPATH@/components/extensions.manifest
#ifdef MOZ_UPDATER
......
......@@ -183,7 +183,7 @@ nsAboutProtocolHandler::NewChannel(nsIURI *uri, nsILoadInfo *aLoadInfo,
!path.EqualsLiteral("newtab") &&
!path.EqualsLiteral("certerror")) {
nsCOMPtr<nsIEnterprisePolicies> policyManager =
do_GetService("@mozilla.org/browser/enterprisepolicies;1", &rv2);
do_GetService("@mozilla.org/enterprisepolicies;1", &rv2);
if (NS_SUCCEEDED(rv2)) {
nsAutoCString normalizedURL;
normalizedURL.AssignLiteral("about:");
......
......@@ -7,8 +7,8 @@ const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
const {AppConstants} = ChromeUtils.import("resource://gre/modules/AppConstants.jsm");
XPCOMUtils.defineLazyModuleGetters(this, {
WindowsGPOParser: "resource:///modules/policies/WindowsGPOParser.jsm",
macOSPoliciesParser: "resource:///modules/policies/macOSPoliciesParser.jsm",
WindowsGPOParser: "resource://gre/modules/policies/WindowsGPOParser.jsm",
macOSPoliciesParser: "resource://gre/modules/policies/macOSPoliciesParser.jsm",
Policies: "resource:///modules/policies/Policies.jsm",
JsonSchemaValidator: "resource://gre/modules/components-utils/JsonSchemaValidator.jsm",
});
......@@ -468,7 +468,7 @@ class WindowsGPOPoliciesProvider {
_readData(wrk, root) {
wrk.open(root, "SOFTWARE\\Policies", wrk.ACCESS_READ);
if (wrk.hasChild("Mozilla\\Firefox")) {
if (wrk.hasChild("Mozilla\\" + Services.appinfo.name)) {
this._policies = WindowsGPOParser.readPolicies(wrk, this._policies);
}
wrk.close();
......
component {ea4e1414-779b-458b-9d1f-d18e8efbc145} EnterprisePolicies.js process=main
contract @mozilla.org/browser/enterprisepolicies;1 {ea4e1414-779b-458b-9d1f-d18e8efbc145} process=main
contract @mozilla.org/enterprisepolicies;1 {ea4e1414-779b-458b-9d1f-d18e8efbc145} process=main
component {dc6358f8-d167-4566-bf5b-4350b5e6a7a2} EnterprisePoliciesContent.js process=content
contract @mozilla.org/browser/enterprisepolicies;1 {dc6358f8-d167-4566-bf5b-4350b5e6a7a2} process=content
contract @mozilla.org/enterprisepolicies;1 {dc6358f8-d167-4566-bf5b-4350b5e6a7a2} process=content
......@@ -4,6 +4,7 @@
"use strict";
const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
const {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
const PREF_LOGLEVEL = "browser.policies.loglevel";
......@@ -23,7 +24,7 @@ var EXPORTED_SYMBOLS = ["WindowsGPOParser"];
var WindowsGPOParser = {
readPolicies(wrk, policies) {
let childWrk = wrk.openChild("Mozilla\\Firefox", wrk.ACCESS_READ);
let childWrk = wrk.openChild("Mozilla\\" + Services.appinfo.name, wrk.ACCESS_READ);
if (!policies) {
policies = {};
}
......
......@@ -12,3 +12,24 @@ XPIDL_SOURCES += [
]
XPIDL_MODULE = 'enterprisepolicies'
TEST_DIRS += [
'tests'
]
if CONFIG['MOZ_WIDGET_TOOLKIT'] != "android":
EXTRA_COMPONENTS += [
'EnterprisePolicies.js',
'EnterprisePolicies.manifest',
'EnterprisePoliciesContent.js',
]
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows':
EXTRA_JS_MODULES.policies += [
'WindowsGPOParser.jsm',
]
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa':
EXTRA_JS_MODULES.policies += [
'macOSPoliciesParser.jsm',
]
[DEFAULT]
head = head.js
support-files =
config_broken_json.json
[browser_policies_basic_tests.js]
[browser_policies_broken_json.js]
[browser_policies_enterprise_only.js]
[browser_policies_mistyped_json.js]
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
const {
EnterprisePolicyTesting,
PoliciesPrefTracker,
} = ChromeUtils.import("resource://testing-common/EnterprisePolicyTesting.jsm", null);
const {TestUtils} = ChromeUtils.import("resource://testing-common/TestUtils.jsm", null);
PoliciesPrefTracker.start();
async function setupPolicyEngineWithJson(json, customSchema) {
PoliciesPrefTracker.restoreDefaultValues();
if (typeof(json) != "object") {
let filePath = getTestFilePath(json ? json : "non-existing-file.json");
return EnterprisePolicyTesting.setupPolicyEngineWithJson(filePath, customSchema);
}
return EnterprisePolicyTesting.setupPolicyEngineWithJson(json, customSchema);
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment