Commit 558a79c4 authored by Gurzau Raul's avatar Gurzau Raul
Browse files

Backed out changeset 18f07982ab28 (bug 1600007) for failing at...

Backed out changeset 18f07982ab28 (bug 1600007) for failing at browser_policy_bookmarks.js on a CLOSED TREE.
parent 9510cd39
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
add_task(async function test_empty_policy() {
await setupPolicyEngineWithJson({
policies: {
Certificates: {},
},
});
equal(
Services.policies.status,
Ci.nsIEnterprisePolicies.INACTIVE,
"Engine is not active"
);
});
...@@ -8,7 +8,6 @@ support-files = ...@@ -8,7 +8,6 @@ support-files =
[test_appupdateurl.js] [test_appupdateurl.js]
[test_clear_blocked_cookies.js] [test_clear_blocked_cookies.js]
[test_defaultbrowsercheck.js] [test_defaultbrowsercheck.js]
[test_empty_policy.js]
[test_extensions.js] [test_extensions.js]
[test_extensionsettings.js] [test_extensionsettings.js]
[test_macosparser_unflatten.js] [test_macosparser_unflatten.js]
......
...@@ -58,20 +58,6 @@ let env = Cc["@mozilla.org/process/environment;1"].getService( ...@@ -58,20 +58,6 @@ let env = Cc["@mozilla.org/process/environment;1"].getService(
); );
const isXpcshell = env.exists("XPCSHELL_TEST_PROFILE_DIR"); const isXpcshell = env.exists("XPCSHELL_TEST_PROFILE_DIR");
// We're only testing for empty objects, not
// empty strings.
function isEmptyObject(obj) {
if (Object.keys(obj).length === 0) {
return true;
}
for (let key of Object.keys(obj)) {
if (typeof obj[key] !== "object" || !isEmptyObject(obj[key])) {
return false;
}
}
return true;
}
function EnterprisePoliciesManager() { function EnterprisePoliciesManager() {
Services.obs.addObserver(this, "profile-after-change", true); Services.obs.addObserver(this, "profile-after-change", true);
Services.obs.addObserver(this, "final-ui-startup", true); Services.obs.addObserver(this, "final-ui-startup", true);
...@@ -457,7 +443,7 @@ class JSONPoliciesProvider { ...@@ -457,7 +443,7 @@ class JSONPoliciesProvider {
get hasPolicies() { get hasPolicies() {
return ( return (
this._failed || this._failed ||
(this._policies !== null && !isEmptyObject(this._policies)) (this._policies !== null && Object.keys(this._policies).length)
); );
} }
...@@ -568,7 +554,7 @@ class WindowsGPOPoliciesProvider { ...@@ -568,7 +554,7 @@ class WindowsGPOPoliciesProvider {
} }
get hasPolicies() { get hasPolicies() {
return this._policies !== null && !isEmptyObject(this._policies); return this._policies !== null && Object.keys(this._policies).length;
} }
get policies() { get policies() {
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
"use strict"; "use strict";
add_task(async function test_empty_toplevel() { add_task(async function test_app_update_URL() {
await setupPolicyEngineWithJson({ await setupPolicyEngineWithJson({
policies: {}, policies: {},
}); });
......
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