зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1491061 - Part 3: Update existing tests that require the content blocking prefs r=baku
Depends on D5888 Differential Revision: https://phabricator.services.mozilla.com/D6356 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
05602760e1
Коммит
da0aaecdb7
|
@ -62,7 +62,12 @@
|
|||
iframe.addEventListener("load", iframeLoaded);
|
||||
}
|
||||
SpecialPowers.pushPrefEnv({
|
||||
"set": [["network.cookie.cookieBehavior", testData[testIndex].cookieBehavior]]
|
||||
"set": [
|
||||
["browser.contentblocking.enabled", true],
|
||||
["browser.contentblocking.ui.enabled", true],
|
||||
["browser.contentblocking.rejecttrackers.ui.enabled", true],
|
||||
["network.cookie.cookieBehavior", testData[testIndex].cookieBehavior],
|
||||
]
|
||||
}, () => {
|
||||
iframe.src = testData[testIndex].host + iframe1Path;
|
||||
});
|
||||
|
|
|
@ -84,6 +84,9 @@ function runTest(aExpectedResponses) {
|
|||
// the given cookie policy.
|
||||
function testShouldIntercept(behavior, lifetime, done) {
|
||||
SpecialPowers.pushPrefEnv({"set": [
|
||||
["browser.contentblocking.enabled", true],
|
||||
["browser.contentblocking.ui.enabled", true],
|
||||
["browser.contentblocking.rejecttrackers.ui.enabled", true],
|
||||
["network.cookie.cookieBehavior", behavior],
|
||||
["network.cookie.lifetimePolicy", lifetime],
|
||||
]}, function() {
|
||||
|
|
|
@ -27,8 +27,12 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1022869
|
|||
"http://example.org/tests/dom/tests/mochitest/bugs/file_prime_cookie.html";
|
||||
waitForLoad().then(function() {
|
||||
// Cookies are set up, disallow third-party cookies and start the test.
|
||||
SpecialPowers.pushPrefEnv({ set: [[ 'network.cookie.cookieBehavior', 1 ]] },
|
||||
() => { continueTest(); });
|
||||
SpecialPowers.pushPrefEnv({ set: [
|
||||
["browser.contentblocking.enabled", true],
|
||||
["browser.contentblocking.ui.enabled", true],
|
||||
["browser.contentblocking.rejecttrackers.ui.enabled", true],
|
||||
["network.cookie.cookieBehavior", 1],
|
||||
]}, () => { continueTest(); });
|
||||
}).catch((e) => { ok(false, `Got exception: ${e}`) });
|
||||
}
|
||||
|
||||
|
|
|
@ -26,7 +26,12 @@ if (inFrame) {
|
|||
}
|
||||
|
||||
function setCookieBehavior(behavior) {
|
||||
return SpecialPowers.pushPrefEnv({"set": [[kPrefName, behavior]]});
|
||||
return SpecialPowers.pushPrefEnv({"set": [
|
||||
["browser.contentblocking.enabled", true],
|
||||
["browser.contentblocking.ui.enabled", true],
|
||||
["browser.contentblocking.rejecttrackers.ui.enabled", true],
|
||||
[kPrefName, behavior],
|
||||
]});
|
||||
}
|
||||
|
||||
function runIFrame(url) {
|
||||
|
|
|
@ -15,8 +15,12 @@
|
|||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
// Set cookies behavior to "always reject".
|
||||
SpecialPowers.pushPrefEnv({"set": [["network.cookie.cookieBehavior", 2]]},
|
||||
test1);
|
||||
SpecialPowers.pushPrefEnv({"set": [
|
||||
["browser.contentblocking.enabled", true],
|
||||
["browser.contentblocking.ui.enabled", true],
|
||||
["browser.contentblocking.rejecttrackers.ui.enabled", true],
|
||||
["network.cookie.cookieBehavior", 2],
|
||||
]}, test1);
|
||||
|
||||
function test1() {
|
||||
try {
|
||||
|
|
|
@ -47,6 +47,9 @@
|
|||
|
||||
add_task(async function blocked() {
|
||||
await SpecialPowers.pushPrefEnv({ set: [
|
||||
["browser.contentblocking.enabled", true],
|
||||
["browser.contentblocking.ui.enabled", true],
|
||||
["browser.contentblocking.rejecttrackers.ui.enabled", true],
|
||||
["network.cookie.cookieBehavior", COOKIE_BEHAVIOR_REJECTFOREIGN]
|
||||
]});
|
||||
let result = await testThirdPartyFrame('blocked');
|
||||
|
|
|
@ -13,7 +13,12 @@ function setupTest(uri, cookies, loads) {
|
|||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var prefSet = new Promise(resolve => {
|
||||
SpecialPowers.pushPrefEnv({ set: [["network.cookie.cookieBehavior", 1]] }, resolve);
|
||||
SpecialPowers.pushPrefEnv({ set: [
|
||||
["browser.contentblocking.enabled", true],
|
||||
["browser.contentblocking.ui.enabled", true],
|
||||
["browser.contentblocking.rejecttrackers.ui.enabled", true],
|
||||
["network.cookie.cookieBehavior", 1],
|
||||
]}, resolve);
|
||||
});
|
||||
|
||||
gScript = SpecialPowers.loadChromeScript(SCRIPT_URL);
|
||||
|
|
|
@ -6,6 +6,11 @@
|
|||
// 2) with channel, but with no docshell parent
|
||||
|
||||
function run_test() {
|
||||
// Set the needed content blocking prefs
|
||||
Services.prefs.setBoolPref("browser.contentblocking.enabled", true);
|
||||
Services.prefs.setBoolPref("browser.contentblocking.ui.enabled", true);
|
||||
Services.prefs.setBoolPref("browser.contentblocking.rejecttrackers.ui.enabled", true);
|
||||
|
||||
// Create URIs and channels pointing to foo.com and bar.com.
|
||||
// We will use these to put foo.com into first and third party contexts.
|
||||
var spec1 = "http://foo.com/foo.html";
|
||||
|
|
Загрузка…
Ссылка в новой задаче