зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset 5521f4a9012d (bug 1440578) for ESlint failure on browser/components/enterprisepolicies/Policies.jsm
--HG-- extra : rebase_source : 3bed0a8a40f946d75b284ae44adc191eb0dfb8cd
This commit is contained in:
Родитель
f524da36b5
Коммит
14def3a81b
|
@ -107,15 +107,6 @@ var Policies = {
|
|||
"Cookies": {
|
||||
onBeforeUIStartup(manager, param) {
|
||||
addAllowDenyPermissions("cookie", param.Allow, param.Block);
|
||||
|
||||
if (param.Block) {
|
||||
const hosts = param.Block.map(uri => uri.host).sort().join('\n');
|
||||
runOncePerModification("clearCookiesForBlockedHosts", hosts, () => {
|
||||
for (let blocked of param.Block) {
|
||||
Services.cookies.removeCookiesWithOriginAttributes("{}", blocked.host);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
@ -21,7 +21,6 @@ support-files =
|
|||
[browser_policy_block_about_profiles.js]
|
||||
[browser_policy_block_about_support.js]
|
||||
[browser_policy_block_set_desktop_background.js]
|
||||
[browser_policy_blocked_cookies.js]
|
||||
[browser_policy_bookmarks.js]
|
||||
[browser_policy_default_browser_check.js]
|
||||
[browser_policy_disable_formhistory.js]
|
||||
|
|
|
@ -1,62 +0,0 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
"use strict";
|
||||
|
||||
|
||||
add_task(async function setup() {
|
||||
const expiry = Date.now() + 24 * 60 * 60;
|
||||
Services.cookies.add("example.com", "/", "secure", "true", true, false, false, expiry, {});
|
||||
Services.cookies.add("example.com", "/", "insecure", "true", false, false, false, expiry, {});
|
||||
Services.cookies.add("example.org", "/", "secure", "true", true, false, false, expiry, {});
|
||||
Services.cookies.add("example.org", "/", "insecure", "true", false, false, false, expiry, {});
|
||||
Services.cookies.add("example.net", "/", "secure", "true", true, false, false, expiry, {});
|
||||
await setupPolicyEngineWithJson({
|
||||
"policies": {
|
||||
"Cookies": {
|
||||
"Block": [
|
||||
"http://example.com",
|
||||
"https://example.org:8080"
|
||||
]
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
function retrieve_all_cookies(host) {
|
||||
const values = [];
|
||||
const cookies = Services.cookies.getCookiesFromHost(host, {});
|
||||
while (cookies.hasMoreElements()) {
|
||||
const cookie = cookies.getNext().QueryInterface(Ci.nsICookie);
|
||||
values.push({
|
||||
host: cookie.host,
|
||||
name: cookie.name,
|
||||
path: cookie.path
|
||||
});
|
||||
}
|
||||
return values;
|
||||
}
|
||||
|
||||
add_task(async function test_cookies_for_blocked_sites_cleared() {
|
||||
const cookies = {
|
||||
hostname: retrieve_all_cookies("example.com"),
|
||||
origin: retrieve_all_cookies("example.org"),
|
||||
keep: retrieve_all_cookies("example.net")
|
||||
};
|
||||
const expected = {
|
||||
hostname: [],
|
||||
origin: [],
|
||||
keep: [
|
||||
{host: "example.net",
|
||||
name: "secure",
|
||||
path: "/"}
|
||||
]
|
||||
};
|
||||
is(JSON.stringify(cookies), JSON.stringify(expected),
|
||||
"All stored cookies for blocked hosts should be cleared");
|
||||
});
|
||||
|
||||
add_task(function teardown() {
|
||||
for (let host of ["example.com", "example.org", "example.net"]) {
|
||||
Services.cookies.removeCookiesWithOriginAttributes("{}", host);
|
||||
}
|
||||
});
|
Загрузка…
Ссылка в новой задаче