mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-29 15:52:07 +00:00
Bug 1491061 - Part 2: Add tests to ensure that third-party cookie blocking restrictions under content blocking also follow UI prefs; r=baku
Differential Revision: https://phabricator.services.mozilla.com/D5888
This commit is contained in:
parent
a7981b7ace
commit
006d7d7aae
@ -30,6 +30,14 @@ support-files = server.sjs
|
|||||||
[browser_imageCache5.js]
|
[browser_imageCache5.js]
|
||||||
[browser_imageCache6.js]
|
[browser_imageCache6.js]
|
||||||
[browser_imageCache7.js]
|
[browser_imageCache7.js]
|
||||||
|
[browser_imageCache8.js]
|
||||||
|
[browser_imageCache9.js]
|
||||||
|
[browser_imageCache10.js]
|
||||||
|
[browser_imageCache11.js]
|
||||||
|
[browser_imageCache12.js]
|
||||||
|
[browser_imageCache13.js]
|
||||||
|
[browser_imageCache14.js]
|
||||||
|
[browser_imageCache15.js]
|
||||||
[browser_onBeforeRequestNotificationForTrackingResources.js]
|
[browser_onBeforeRequestNotificationForTrackingResources.js]
|
||||||
[browser_onModifyRequestNotificationForTrackingResources.js]
|
[browser_onModifyRequestNotificationForTrackingResources.js]
|
||||||
[browser_permissionInNormalWindows.js]
|
[browser_permissionInNormalWindows.js]
|
||||||
|
@ -6,6 +6,8 @@ add_task(async function() {
|
|||||||
await SpecialPowers.flushPrefEnv();
|
await SpecialPowers.flushPrefEnv();
|
||||||
await SpecialPowers.pushPrefEnv({"set": [
|
await SpecialPowers.pushPrefEnv({"set": [
|
||||||
["browser.contentblocking.enabled", true],
|
["browser.contentblocking.enabled", true],
|
||||||
|
["browser.contentblocking.ui.enabled", true],
|
||||||
|
["browser.contentblocking.rejecttrackers.ui.enabled", true],
|
||||||
["browser.fastblock.enabled", false],
|
["browser.fastblock.enabled", false],
|
||||||
["network.cookie.cookieBehavior", Ci.nsICookieService.BEHAVIOR_REJECT_TRACKER],
|
["network.cookie.cookieBehavior", Ci.nsICookieService.BEHAVIOR_REJECT_TRACKER],
|
||||||
["privacy.trackingprotection.enabled", false],
|
["privacy.trackingprotection.enabled", false],
|
||||||
|
@ -75,6 +75,8 @@ add_task(async function() {
|
|||||||
// Now set up our prefs
|
// Now set up our prefs
|
||||||
await SpecialPowers.pushPrefEnv({"set": [
|
await SpecialPowers.pushPrefEnv({"set": [
|
||||||
["browser.contentblocking.enabled", true],
|
["browser.contentblocking.enabled", true],
|
||||||
|
["browser.contentblocking.ui.enabled", true],
|
||||||
|
["browser.contentblocking.rejecttrackers.ui.enabled", true],
|
||||||
["network.cookie.cookieBehavior", Ci.nsICookieService.BEHAVIOR_REJECT_TRACKER],
|
["network.cookie.cookieBehavior", Ci.nsICookieService.BEHAVIOR_REJECT_TRACKER],
|
||||||
]});
|
]});
|
||||||
|
|
||||||
|
@ -2,6 +2,8 @@ ChromeUtils.import("resource://gre/modules/Services.jsm");
|
|||||||
|
|
||||||
let cookieBehavior = BEHAVIOR_REJECT_TRACKER;
|
let cookieBehavior = BEHAVIOR_REJECT_TRACKER;
|
||||||
let blockingByContentBlocking = false;
|
let blockingByContentBlocking = false;
|
||||||
|
let blockingByContentBlockingUI = true;
|
||||||
|
let blockingByContentBlockingRTUI = true;
|
||||||
let blockingByAllowList = false;
|
let blockingByAllowList = false;
|
||||||
let expectedBlockingNotifications = true;
|
let expectedBlockingNotifications = true;
|
||||||
|
|
||||||
|
@ -0,0 +1,18 @@
|
|||||||
|
ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||||
|
|
||||||
|
let cookieBehavior = BEHAVIOR_REJECT_FOREIGN;
|
||||||
|
let blockingByContentBlocking = false;
|
||||||
|
let blockingByContentBlockingUI = true;
|
||||||
|
let blockingByContentBlockingRTUI = true;
|
||||||
|
let blockingByAllowList = false;
|
||||||
|
let expectedBlockingNotifications = true;
|
||||||
|
|
||||||
|
let rootDir = getRootDirectory(gTestPath);
|
||||||
|
let jar = getJar(rootDir);
|
||||||
|
if (jar) {
|
||||||
|
let tmpdir = extractJarToTmp(jar);
|
||||||
|
rootDir = "file://" + tmpdir.path + "/";
|
||||||
|
}
|
||||||
|
/* import-globals-from imageCacheWorker.js */
|
||||||
|
Services.scriptloader.loadSubScript(rootDir + "imageCacheWorker.js", this);
|
||||||
|
|
@ -0,0 +1,18 @@
|
|||||||
|
ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||||
|
|
||||||
|
let cookieBehavior = BEHAVIOR_REJECT_FOREIGN;
|
||||||
|
let blockingByContentBlocking = true;
|
||||||
|
let blockingByContentBlockingUI = false;
|
||||||
|
let blockingByContentBlockingRTUI = true;
|
||||||
|
let blockingByAllowList = false;
|
||||||
|
let expectedBlockingNotifications = true;
|
||||||
|
|
||||||
|
let rootDir = getRootDirectory(gTestPath);
|
||||||
|
let jar = getJar(rootDir);
|
||||||
|
if (jar) {
|
||||||
|
let tmpdir = extractJarToTmp(jar);
|
||||||
|
rootDir = "file://" + tmpdir.path + "/";
|
||||||
|
}
|
||||||
|
/* import-globals-from imageCacheWorker.js */
|
||||||
|
Services.scriptloader.loadSubScript(rootDir + "imageCacheWorker.js", this);
|
||||||
|
|
@ -0,0 +1,18 @@
|
|||||||
|
ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||||
|
|
||||||
|
let cookieBehavior = BEHAVIOR_REJECT_FOREIGN;
|
||||||
|
let blockingByContentBlocking = true;
|
||||||
|
let blockingByContentBlockingUI = true;
|
||||||
|
let blockingByContentBlockingRTUI = false;
|
||||||
|
let blockingByAllowList = false;
|
||||||
|
let expectedBlockingNotifications = true;
|
||||||
|
|
||||||
|
let rootDir = getRootDirectory(gTestPath);
|
||||||
|
let jar = getJar(rootDir);
|
||||||
|
if (jar) {
|
||||||
|
let tmpdir = extractJarToTmp(jar);
|
||||||
|
rootDir = "file://" + tmpdir.path + "/";
|
||||||
|
}
|
||||||
|
/* import-globals-from imageCacheWorker.js */
|
||||||
|
Services.scriptloader.loadSubScript(rootDir + "imageCacheWorker.js", this);
|
||||||
|
|
@ -0,0 +1,21 @@
|
|||||||
|
ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||||
|
|
||||||
|
/* Setting a custom permission for this website */
|
||||||
|
let uriObj = Services.io.newURI(TEST_DOMAIN);
|
||||||
|
Services.perms.add(uriObj, "cookie", Services.perms.ALLOW_ACTION);
|
||||||
|
|
||||||
|
let cookieBehavior = BEHAVIOR_REJECT_TRACKER;
|
||||||
|
let blockingByContentBlocking = false;
|
||||||
|
let blockingByContentBlockingUI = true;
|
||||||
|
let blockingByContentBlockingRTUI = true;
|
||||||
|
let blockingByAllowList = false;
|
||||||
|
let expectedBlockingNotifications = false;
|
||||||
|
|
||||||
|
let rootDir = getRootDirectory(gTestPath);
|
||||||
|
let jar = getJar(rootDir);
|
||||||
|
if (jar) {
|
||||||
|
let tmpdir = extractJarToTmp(jar);
|
||||||
|
rootDir = "file://" + tmpdir.path + "/";
|
||||||
|
}
|
||||||
|
/* import-globals-from imageCacheWorker.js */
|
||||||
|
Services.scriptloader.loadSubScript(rootDir + "imageCacheWorker.js", this);
|
@ -0,0 +1,21 @@
|
|||||||
|
ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||||
|
|
||||||
|
/* Setting a custom permission for this website */
|
||||||
|
let uriObj = Services.io.newURI(TEST_DOMAIN);
|
||||||
|
Services.perms.add(uriObj, "cookie", Services.perms.ALLOW_ACTION);
|
||||||
|
|
||||||
|
let cookieBehavior = BEHAVIOR_REJECT_TRACKER;
|
||||||
|
let blockingByContentBlocking = true;
|
||||||
|
let blockingByContentBlockingUI = false;
|
||||||
|
let blockingByContentBlockingRTUI = true;
|
||||||
|
let blockingByAllowList = false;
|
||||||
|
let expectedBlockingNotifications = false;
|
||||||
|
|
||||||
|
let rootDir = getRootDirectory(gTestPath);
|
||||||
|
let jar = getJar(rootDir);
|
||||||
|
if (jar) {
|
||||||
|
let tmpdir = extractJarToTmp(jar);
|
||||||
|
rootDir = "file://" + tmpdir.path + "/";
|
||||||
|
}
|
||||||
|
/* import-globals-from imageCacheWorker.js */
|
||||||
|
Services.scriptloader.loadSubScript(rootDir + "imageCacheWorker.js", this);
|
@ -0,0 +1,21 @@
|
|||||||
|
ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||||
|
|
||||||
|
/* Setting a custom permission for this website */
|
||||||
|
let uriObj = Services.io.newURI(TEST_DOMAIN);
|
||||||
|
Services.perms.add(uriObj, "cookie", Services.perms.ALLOW_ACTION);
|
||||||
|
|
||||||
|
let cookieBehavior = BEHAVIOR_REJECT_TRACKER;
|
||||||
|
let blockingByContentBlocking = true;
|
||||||
|
let blockingByContentBlockingUI = true;
|
||||||
|
let blockingByContentBlockingRTUI = false;
|
||||||
|
let blockingByAllowList = false;
|
||||||
|
let expectedBlockingNotifications = false;
|
||||||
|
|
||||||
|
let rootDir = getRootDirectory(gTestPath);
|
||||||
|
let jar = getJar(rootDir);
|
||||||
|
if (jar) {
|
||||||
|
let tmpdir = extractJarToTmp(jar);
|
||||||
|
rootDir = "file://" + tmpdir.path + "/";
|
||||||
|
}
|
||||||
|
/* import-globals-from imageCacheWorker.js */
|
||||||
|
Services.scriptloader.loadSubScript(rootDir + "imageCacheWorker.js", this);
|
@ -2,6 +2,8 @@ ChromeUtils.import("resource://gre/modules/Services.jsm");
|
|||||||
|
|
||||||
let cookieBehavior = BEHAVIOR_REJECT_TRACKER;
|
let cookieBehavior = BEHAVIOR_REJECT_TRACKER;
|
||||||
let blockingByContentBlocking = true;
|
let blockingByContentBlocking = true;
|
||||||
|
let blockingByContentBlockingUI = false;
|
||||||
|
let blockingByContentBlockingRTUI = true;
|
||||||
let blockingByAllowList = false;
|
let blockingByAllowList = false;
|
||||||
let expectedBlockingNotifications = true;
|
let expectedBlockingNotifications = true;
|
||||||
|
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
ChromeUtils.import("resource://gre/modules/Services.jsm");
|
ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||||
|
|
||||||
let cookieBehavior = BEHAVIOR_REJECT_TRACKER;
|
let cookieBehavior = BEHAVIOR_REJECT_TRACKER;
|
||||||
let blockingByContentBlocking = false;
|
let blockingByContentBlocking = true;
|
||||||
|
let blockingByContentBlockingUI = true;
|
||||||
|
let blockingByContentBlockingRTUI = false;
|
||||||
let blockingByAllowList = false;
|
let blockingByAllowList = false;
|
||||||
let expectedBlockingNotifications = true;
|
let expectedBlockingNotifications = true;
|
||||||
|
|
||||||
|
@ -2,7 +2,9 @@ ChromeUtils.import("resource://gre/modules/Services.jsm");
|
|||||||
|
|
||||||
let cookieBehavior = BEHAVIOR_REJECT_TRACKER;
|
let cookieBehavior = BEHAVIOR_REJECT_TRACKER;
|
||||||
let blockingByContentBlocking = true;
|
let blockingByContentBlocking = true;
|
||||||
let blockingByAllowList = true;
|
let blockingByContentBlockingUI = true;
|
||||||
|
let blockingByContentBlockingRTUI = true;
|
||||||
|
let blockingByAllowList = false;
|
||||||
let expectedBlockingNotifications = true;
|
let expectedBlockingNotifications = true;
|
||||||
|
|
||||||
let rootDir = getRootDirectory(gTestPath);
|
let rootDir = getRootDirectory(gTestPath);
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
ChromeUtils.import("resource://gre/modules/Services.jsm");
|
ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||||
|
|
||||||
let cookieBehavior = BEHAVIOR_REJECT_FOREIGN;
|
let cookieBehavior = BEHAVIOR_REJECT_TRACKER;
|
||||||
let blockingByContentBlocking = true;
|
let blockingByContentBlocking = false;
|
||||||
let blockingByAllowList = true;
|
let blockingByContentBlockingUI = true;
|
||||||
|
let blockingByContentBlockingRTUI = true;
|
||||||
|
let blockingByAllowList = false;
|
||||||
let expectedBlockingNotifications = true;
|
let expectedBlockingNotifications = true;
|
||||||
|
|
||||||
let rootDir = getRootDirectory(gTestPath);
|
let rootDir = getRootDirectory(gTestPath);
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
ChromeUtils.import("resource://gre/modules/Services.jsm");
|
ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||||
|
|
||||||
let cookieBehavior = BEHAVIOR_REJECT_FOREIGN;
|
let cookieBehavior = BEHAVIOR_REJECT_TRACKER;
|
||||||
let blockingByContentBlocking = false;
|
let blockingByContentBlocking = true;
|
||||||
|
let blockingByContentBlockingUI = false;
|
||||||
|
let blockingByContentBlockingRTUI = true;
|
||||||
let blockingByAllowList = false;
|
let blockingByAllowList = false;
|
||||||
let expectedBlockingNotifications = true;
|
let expectedBlockingNotifications = true;
|
||||||
|
|
||||||
|
@ -1,13 +1,11 @@
|
|||||||
ChromeUtils.import("resource://gre/modules/Services.jsm");
|
ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||||
|
|
||||||
/* Setting a custom permission for this website */
|
|
||||||
let uriObj = Services.io.newURI(TEST_DOMAIN);
|
|
||||||
Services.perms.add(uriObj, "cookie", Services.perms.ALLOW_ACTION);
|
|
||||||
|
|
||||||
let cookieBehavior = BEHAVIOR_REJECT_TRACKER;
|
let cookieBehavior = BEHAVIOR_REJECT_TRACKER;
|
||||||
let blockingByContentBlocking = false;
|
let blockingByContentBlocking = true;
|
||||||
|
let blockingByContentBlockingUI = true;
|
||||||
|
let blockingByContentBlockingRTUI = false;
|
||||||
let blockingByAllowList = false;
|
let blockingByAllowList = false;
|
||||||
let expectedBlockingNotifications = false;
|
let expectedBlockingNotifications = true;
|
||||||
|
|
||||||
let rootDir = getRootDirectory(gTestPath);
|
let rootDir = getRootDirectory(gTestPath);
|
||||||
let jar = getJar(rootDir);
|
let jar = getJar(rootDir);
|
||||||
@ -17,3 +15,4 @@ if (jar) {
|
|||||||
}
|
}
|
||||||
/* import-globals-from imageCacheWorker.js */
|
/* import-globals-from imageCacheWorker.js */
|
||||||
Services.scriptloader.loadSubScript(rootDir + "imageCacheWorker.js", this);
|
Services.scriptloader.loadSubScript(rootDir + "imageCacheWorker.js", this);
|
||||||
|
|
||||||
|
@ -0,0 +1,18 @@
|
|||||||
|
ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||||
|
|
||||||
|
let cookieBehavior = BEHAVIOR_REJECT_TRACKER;
|
||||||
|
let blockingByContentBlocking = true;
|
||||||
|
let blockingByContentBlockingUI = true;
|
||||||
|
let blockingByContentBlockingRTUI = true;
|
||||||
|
let blockingByAllowList = true;
|
||||||
|
let expectedBlockingNotifications = true;
|
||||||
|
|
||||||
|
let rootDir = getRootDirectory(gTestPath);
|
||||||
|
let jar = getJar(rootDir);
|
||||||
|
if (jar) {
|
||||||
|
let tmpdir = extractJarToTmp(jar);
|
||||||
|
rootDir = "file://" + tmpdir.path + "/";
|
||||||
|
}
|
||||||
|
/* import-globals-from imageCacheWorker.js */
|
||||||
|
Services.scriptloader.loadSubScript(rootDir + "imageCacheWorker.js", this);
|
||||||
|
|
@ -0,0 +1,18 @@
|
|||||||
|
ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||||
|
|
||||||
|
let cookieBehavior = BEHAVIOR_REJECT_FOREIGN;
|
||||||
|
let blockingByContentBlocking = true;
|
||||||
|
let blockingByContentBlockingUI = true;
|
||||||
|
let blockingByContentBlockingRTUI = true;
|
||||||
|
let blockingByAllowList = true;
|
||||||
|
let expectedBlockingNotifications = true;
|
||||||
|
|
||||||
|
let rootDir = getRootDirectory(gTestPath);
|
||||||
|
let jar = getJar(rootDir);
|
||||||
|
if (jar) {
|
||||||
|
let tmpdir = extractJarToTmp(jar);
|
||||||
|
rootDir = "file://" + tmpdir.path + "/";
|
||||||
|
}
|
||||||
|
/* import-globals-from imageCacheWorker.js */
|
||||||
|
Services.scriptloader.loadSubScript(rootDir + "imageCacheWorker.js", this);
|
||||||
|
|
@ -53,6 +53,8 @@ add_task(async function() {
|
|||||||
await SpecialPowers.flushPrefEnv();
|
await SpecialPowers.flushPrefEnv();
|
||||||
await SpecialPowers.pushPrefEnv({"set": [
|
await SpecialPowers.pushPrefEnv({"set": [
|
||||||
["browser.contentblocking.enabled", true],
|
["browser.contentblocking.enabled", true],
|
||||||
|
["browser.contentblocking.ui.enabled", true],
|
||||||
|
["browser.contentblocking.rejecttrackers.ui.enabled", true],
|
||||||
["browser.fastblock.enabled", false],
|
["browser.fastblock.enabled", false],
|
||||||
["privacy.trackingprotection.enabled", true],
|
["privacy.trackingprotection.enabled", true],
|
||||||
// the test doesn't open a private window, so we don't care about this pref's value
|
// the test doesn't open a private window, so we don't care about this pref's value
|
||||||
|
@ -48,6 +48,8 @@ add_task(async function() {
|
|||||||
await SpecialPowers.flushPrefEnv();
|
await SpecialPowers.flushPrefEnv();
|
||||||
await SpecialPowers.pushPrefEnv({"set": [
|
await SpecialPowers.pushPrefEnv({"set": [
|
||||||
["browser.contentblocking.enabled", true],
|
["browser.contentblocking.enabled", true],
|
||||||
|
["browser.contentblocking.ui.enabled", true],
|
||||||
|
["browser.contentblocking.rejecttrackers.ui.enabled", true],
|
||||||
["browser.fastblock.enabled", false],
|
["browser.fastblock.enabled", false],
|
||||||
["privacy.trackingprotection.enabled", true],
|
["privacy.trackingprotection.enabled", true],
|
||||||
// the test doesn't open a private window, so we don't care about this pref's value
|
// the test doesn't open a private window, so we don't care about this pref's value
|
||||||
|
@ -6,6 +6,8 @@ add_task(async function() {
|
|||||||
await SpecialPowers.flushPrefEnv();
|
await SpecialPowers.flushPrefEnv();
|
||||||
await SpecialPowers.pushPrefEnv({"set": [
|
await SpecialPowers.pushPrefEnv({"set": [
|
||||||
["browser.contentblocking.enabled", true],
|
["browser.contentblocking.enabled", true],
|
||||||
|
["browser.contentblocking.ui.enabled", true],
|
||||||
|
["browser.contentblocking.rejecttrackers.ui.enabled", true],
|
||||||
["browser.fastblock.enabled", false],
|
["browser.fastblock.enabled", false],
|
||||||
["network.cookie.cookieBehavior", Ci.nsICookieService.BEHAVIOR_REJECT_TRACKER],
|
["network.cookie.cookieBehavior", Ci.nsICookieService.BEHAVIOR_REJECT_TRACKER],
|
||||||
["privacy.trackingprotection.enabled", false],
|
["privacy.trackingprotection.enabled", false],
|
||||||
|
@ -6,6 +6,8 @@ add_task(async function() {
|
|||||||
await SpecialPowers.flushPrefEnv();
|
await SpecialPowers.flushPrefEnv();
|
||||||
await SpecialPowers.pushPrefEnv({"set": [
|
await SpecialPowers.pushPrefEnv({"set": [
|
||||||
["browser.contentblocking.enabled", true],
|
["browser.contentblocking.enabled", true],
|
||||||
|
["browser.contentblocking.ui.enabled", true],
|
||||||
|
["browser.contentblocking.rejecttrackers.ui.enabled", true],
|
||||||
["browser.fastblock.enabled", false],
|
["browser.fastblock.enabled", false],
|
||||||
["network.cookie.cookieBehavior", Ci.nsICookieService.BEHAVIOR_REJECT_TRACKER],
|
["network.cookie.cookieBehavior", Ci.nsICookieService.BEHAVIOR_REJECT_TRACKER],
|
||||||
["privacy.trackingprotection.enabled", false],
|
["privacy.trackingprotection.enabled", false],
|
||||||
|
@ -20,7 +20,7 @@ var gFeatures = undefined;
|
|||||||
|
|
||||||
let {UrlClassifierTestUtils} = ChromeUtils.import("resource://testing-common/UrlClassifierTestUtils.jsm", {});
|
let {UrlClassifierTestUtils} = ChromeUtils.import("resource://testing-common/UrlClassifierTestUtils.jsm", {});
|
||||||
|
|
||||||
requestLongerTimeout(2);
|
requestLongerTimeout(3);
|
||||||
|
|
||||||
this.AntiTracking = {
|
this.AntiTracking = {
|
||||||
runTest(name, callbackTracking, callbackNonTracking, cleanupFunction, extraPrefs,
|
runTest(name, callbackTracking, callbackNonTracking, cleanupFunction, extraPrefs,
|
||||||
@ -31,6 +31,8 @@ this.AntiTracking = {
|
|||||||
name,
|
name,
|
||||||
cookieBehavior: BEHAVIOR_REJECT_TRACKER,
|
cookieBehavior: BEHAVIOR_REJECT_TRACKER,
|
||||||
blockingByContentBlocking: true,
|
blockingByContentBlocking: true,
|
||||||
|
blockingByContentBlockingUI: true,
|
||||||
|
blockingByContentBlockingRTUI: true,
|
||||||
allowList: false,
|
allowList: false,
|
||||||
callback: callbackTracking,
|
callback: callbackTracking,
|
||||||
extraPrefs,
|
extraPrefs,
|
||||||
@ -57,6 +59,18 @@ this.AntiTracking = {
|
|||||||
} else {
|
} else {
|
||||||
options.blockingByContentBlocking = false;
|
options.blockingByContentBlocking = false;
|
||||||
}
|
}
|
||||||
|
if ("blockingByContentBlockingUI" in callbackNonTracking) {
|
||||||
|
options.blockingByContentBlockingUI =
|
||||||
|
callbackNonTracking.blockingByContentBlockingUI;
|
||||||
|
} else {
|
||||||
|
options.blockingByContentBlockingUI = false;
|
||||||
|
}
|
||||||
|
if ("blockingByContentBlockingRTUI" in callbackNonTracking) {
|
||||||
|
options.blockingByContentBlockingRTUI =
|
||||||
|
callbackNonTracking.blockingByContentBlockingRTUI;
|
||||||
|
} else {
|
||||||
|
options.blockingByContentBlockingRTUI = false;
|
||||||
|
}
|
||||||
if ("blockingByAllowList" in callbackNonTracking) {
|
if ("blockingByAllowList" in callbackNonTracking) {
|
||||||
options.blockingByAllowList =
|
options.blockingByAllowList =
|
||||||
callbackNonTracking.blockingByAllowList;
|
callbackNonTracking.blockingByAllowList;
|
||||||
@ -67,9 +81,11 @@ this.AntiTracking = {
|
|||||||
|
|
||||||
// Phase 1: Here we want to test that a 3rd party context is not blocked if pref is off.
|
// Phase 1: Here we want to test that a 3rd party context is not blocked if pref is off.
|
||||||
if (runExtraTests) {
|
if (runExtraTests) {
|
||||||
// There are four ways in which the third-party context may not be blocked:
|
// There are six ways in which the third-party context may not be blocked:
|
||||||
// * If the cookieBehavior pref causes it to not be blocked.
|
// * If the cookieBehavior pref causes it to not be blocked.
|
||||||
// * If the contentBlocking pref causes it to not be blocked.
|
// * If the contentBlocking pref causes it to not be blocked.
|
||||||
|
// * If the contentBlocking UI pref causes it to not be blocked.
|
||||||
|
// * If the contentBlocking third-party cookies UI pref causes it to not be blocked.
|
||||||
// * If both of these prefs cause it to not be blocked.
|
// * If both of these prefs cause it to not be blocked.
|
||||||
// * If the top-level page is on the content blocking allow list.
|
// * If the top-level page is on the content blocking allow list.
|
||||||
// All of these cases are tested here.
|
// All of these cases are tested here.
|
||||||
@ -77,6 +93,8 @@ this.AntiTracking = {
|
|||||||
name,
|
name,
|
||||||
cookieBehavior: BEHAVIOR_ACCEPT,
|
cookieBehavior: BEHAVIOR_ACCEPT,
|
||||||
blockingByContentBlocking: true,
|
blockingByContentBlocking: true,
|
||||||
|
blockingByContentBlockingUI: true,
|
||||||
|
blockingByContentBlockingRTUI: true,
|
||||||
allowList: false,
|
allowList: false,
|
||||||
callback: callbackNonTracking,
|
callback: callbackNonTracking,
|
||||||
extraPrefs: [],
|
extraPrefs: [],
|
||||||
@ -90,6 +108,38 @@ this.AntiTracking = {
|
|||||||
name,
|
name,
|
||||||
cookieBehavior: BEHAVIOR_REJECT_FOREIGN,
|
cookieBehavior: BEHAVIOR_REJECT_FOREIGN,
|
||||||
blockingByContentBlocking: false,
|
blockingByContentBlocking: false,
|
||||||
|
blockingByContentBlockingUI: true,
|
||||||
|
blockingByContentBlockingRTUI: true,
|
||||||
|
allowList: false,
|
||||||
|
callback: callbackNonTracking,
|
||||||
|
extraPrefs: [],
|
||||||
|
expectedBlockingNotifications: false,
|
||||||
|
runInPrivateWindow,
|
||||||
|
iframeSandbox,
|
||||||
|
});
|
||||||
|
this._createCleanupTask(cleanupFunction);
|
||||||
|
|
||||||
|
this._createTask({
|
||||||
|
name,
|
||||||
|
cookieBehavior: BEHAVIOR_REJECT_FOREIGN,
|
||||||
|
blockingByContentBlocking: true,
|
||||||
|
blockingByContentBlockingUI: false,
|
||||||
|
blockingByContentBlockingRTUI: true,
|
||||||
|
allowList: false,
|
||||||
|
callback: callbackNonTracking,
|
||||||
|
extraPrefs: [],
|
||||||
|
expectedBlockingNotifications: false,
|
||||||
|
runInPrivateWindow,
|
||||||
|
iframeSandbox,
|
||||||
|
});
|
||||||
|
this._createCleanupTask(cleanupFunction);
|
||||||
|
|
||||||
|
this._createTask({
|
||||||
|
name,
|
||||||
|
cookieBehavior: BEHAVIOR_REJECT_FOREIGN,
|
||||||
|
blockingByContentBlocking: true,
|
||||||
|
blockingByContentBlockingUI: true,
|
||||||
|
blockingByContentBlockingRTUI: false,
|
||||||
allowList: false,
|
allowList: false,
|
||||||
callback: callbackNonTracking,
|
callback: callbackNonTracking,
|
||||||
extraPrefs: [],
|
extraPrefs: [],
|
||||||
@ -103,6 +153,38 @@ this.AntiTracking = {
|
|||||||
name,
|
name,
|
||||||
cookieBehavior: BEHAVIOR_REJECT_TRACKER,
|
cookieBehavior: BEHAVIOR_REJECT_TRACKER,
|
||||||
blockingByContentBlocking: false,
|
blockingByContentBlocking: false,
|
||||||
|
blockingByContentBlockingUI: true,
|
||||||
|
blockingByContentBlockingRTUI: true,
|
||||||
|
allowList: false,
|
||||||
|
callback: callbackNonTracking,
|
||||||
|
extraPrefs: [],
|
||||||
|
expectedBlockingNotifications: false,
|
||||||
|
runInPrivateWindow,
|
||||||
|
iframeSandbox,
|
||||||
|
});
|
||||||
|
this._createCleanupTask(cleanupFunction);
|
||||||
|
|
||||||
|
this._createTask({
|
||||||
|
name,
|
||||||
|
cookieBehavior: BEHAVIOR_REJECT_TRACKER,
|
||||||
|
blockingByContentBlocking: true,
|
||||||
|
blockingByContentBlockingUI: false,
|
||||||
|
blockingByContentBlockingRTUI: true,
|
||||||
|
allowList: false,
|
||||||
|
callback: callbackNonTracking,
|
||||||
|
extraPrefs: [],
|
||||||
|
expectedBlockingNotifications: false,
|
||||||
|
runInPrivateWindow,
|
||||||
|
iframeSandbox,
|
||||||
|
});
|
||||||
|
this._createCleanupTask(cleanupFunction);
|
||||||
|
|
||||||
|
this._createTask({
|
||||||
|
name,
|
||||||
|
cookieBehavior: BEHAVIOR_REJECT_TRACKER,
|
||||||
|
blockingByContentBlocking: true,
|
||||||
|
blockingByContentBlockingUI: true,
|
||||||
|
blockingByContentBlockingRTUI: false,
|
||||||
allowList: false,
|
allowList: false,
|
||||||
callback: callbackNonTracking,
|
callback: callbackNonTracking,
|
||||||
extraPrefs: [],
|
extraPrefs: [],
|
||||||
@ -116,6 +198,38 @@ this.AntiTracking = {
|
|||||||
name,
|
name,
|
||||||
cookieBehavior: BEHAVIOR_REJECT_FOREIGN,
|
cookieBehavior: BEHAVIOR_REJECT_FOREIGN,
|
||||||
blockingByContentBlocking: false,
|
blockingByContentBlocking: false,
|
||||||
|
blockingByContentBlockingUI: true,
|
||||||
|
blockingByContentBlockingRTUI: true,
|
||||||
|
allowList: true,
|
||||||
|
callback: callbackNonTracking,
|
||||||
|
extraPrefs: [],
|
||||||
|
expectedBlockingNotifications: false,
|
||||||
|
runInPrivateWindow,
|
||||||
|
iframeSandbox,
|
||||||
|
});
|
||||||
|
this._createCleanupTask(cleanupFunction);
|
||||||
|
|
||||||
|
this._createTask({
|
||||||
|
name,
|
||||||
|
cookieBehavior: BEHAVIOR_REJECT_FOREIGN,
|
||||||
|
blockingByContentBlocking: true,
|
||||||
|
blockingByContentBlockingUI: false,
|
||||||
|
blockingByContentBlockingRTUI: true,
|
||||||
|
allowList: true,
|
||||||
|
callback: callbackNonTracking,
|
||||||
|
extraPrefs: [],
|
||||||
|
expectedBlockingNotifications: false,
|
||||||
|
runInPrivateWindow,
|
||||||
|
iframeSandbox,
|
||||||
|
});
|
||||||
|
this._createCleanupTask(cleanupFunction);
|
||||||
|
|
||||||
|
this._createTask({
|
||||||
|
name,
|
||||||
|
cookieBehavior: BEHAVIOR_REJECT_FOREIGN,
|
||||||
|
blockingByContentBlocking: true,
|
||||||
|
blockingByContentBlockingUI: true,
|
||||||
|
blockingByContentBlockingRTUI: false,
|
||||||
allowList: true,
|
allowList: true,
|
||||||
callback: callbackNonTracking,
|
callback: callbackNonTracking,
|
||||||
extraPrefs: [],
|
extraPrefs: [],
|
||||||
@ -129,6 +243,38 @@ this.AntiTracking = {
|
|||||||
name,
|
name,
|
||||||
cookieBehavior: BEHAVIOR_REJECT_TRACKER,
|
cookieBehavior: BEHAVIOR_REJECT_TRACKER,
|
||||||
blockingByContentBlocking: false,
|
blockingByContentBlocking: false,
|
||||||
|
blockingByContentBlockingUI: true,
|
||||||
|
blockingByContentBlockingRTUI: true,
|
||||||
|
allowList: true,
|
||||||
|
callback: callbackNonTracking,
|
||||||
|
extraPrefs: [],
|
||||||
|
expectedBlockingNotifications: false,
|
||||||
|
runInPrivateWindow,
|
||||||
|
iframeSandbox,
|
||||||
|
});
|
||||||
|
this._createCleanupTask(cleanupFunction);
|
||||||
|
|
||||||
|
this._createTask({
|
||||||
|
name,
|
||||||
|
cookieBehavior: BEHAVIOR_REJECT_TRACKER,
|
||||||
|
blockingByContentBlocking: true,
|
||||||
|
blockingByContentBlockingUI: false,
|
||||||
|
blockingByContentBlockingRTUI: true,
|
||||||
|
allowList: true,
|
||||||
|
callback: callbackNonTracking,
|
||||||
|
extraPrefs: [],
|
||||||
|
expectedBlockingNotifications: false,
|
||||||
|
runInPrivateWindow,
|
||||||
|
iframeSandbox,
|
||||||
|
});
|
||||||
|
this._createCleanupTask(cleanupFunction);
|
||||||
|
|
||||||
|
this._createTask({
|
||||||
|
name,
|
||||||
|
cookieBehavior: BEHAVIOR_REJECT_TRACKER,
|
||||||
|
blockingByContentBlocking: true,
|
||||||
|
blockingByContentBlockingUI: true,
|
||||||
|
blockingByContentBlockingRTUI: false,
|
||||||
allowList: true,
|
allowList: true,
|
||||||
callback: callbackNonTracking,
|
callback: callbackNonTracking,
|
||||||
extraPrefs: [],
|
extraPrefs: [],
|
||||||
@ -142,6 +288,38 @@ this.AntiTracking = {
|
|||||||
name,
|
name,
|
||||||
cookieBehavior: BEHAVIOR_ACCEPT,
|
cookieBehavior: BEHAVIOR_ACCEPT,
|
||||||
blockingByContentBlocking: false,
|
blockingByContentBlocking: false,
|
||||||
|
blockingByContentBlockingUI: true,
|
||||||
|
blockingByContentBlockingRTUI: true,
|
||||||
|
allowList: false,
|
||||||
|
callback: callbackNonTracking,
|
||||||
|
extraPrefs: [],
|
||||||
|
expectedBlockingNotifications: false,
|
||||||
|
runInPrivateWindow,
|
||||||
|
iframeSandbox,
|
||||||
|
});
|
||||||
|
this._createCleanupTask(cleanupFunction);
|
||||||
|
|
||||||
|
this._createTask({
|
||||||
|
name,
|
||||||
|
cookieBehavior: BEHAVIOR_ACCEPT,
|
||||||
|
blockingByContentBlocking: true,
|
||||||
|
blockingByContentBlockingUI: false,
|
||||||
|
blockingByContentBlockingRTUI: true,
|
||||||
|
allowList: false,
|
||||||
|
callback: callbackNonTracking,
|
||||||
|
extraPrefs: [],
|
||||||
|
expectedBlockingNotifications: false,
|
||||||
|
runInPrivateWindow,
|
||||||
|
iframeSandbox,
|
||||||
|
});
|
||||||
|
this._createCleanupTask(cleanupFunction);
|
||||||
|
|
||||||
|
this._createTask({
|
||||||
|
name,
|
||||||
|
cookieBehavior: BEHAVIOR_ACCEPT,
|
||||||
|
blockingByContentBlocking: true,
|
||||||
|
blockingByContentBlockingUI: true,
|
||||||
|
blockingByContentBlockingRTUI: false,
|
||||||
allowList: false,
|
allowList: false,
|
||||||
callback: callbackNonTracking,
|
callback: callbackNonTracking,
|
||||||
extraPrefs: [],
|
extraPrefs: [],
|
||||||
@ -156,6 +334,8 @@ this.AntiTracking = {
|
|||||||
name,
|
name,
|
||||||
cookieBehavior: BEHAVIOR_REJECT_FOREIGN,
|
cookieBehavior: BEHAVIOR_REJECT_FOREIGN,
|
||||||
blockingByContentBlocking: true,
|
blockingByContentBlocking: true,
|
||||||
|
blockingByContentBlockingUI: true,
|
||||||
|
blockingByContentBlockingRTUI: true,
|
||||||
allowList: true,
|
allowList: true,
|
||||||
callback: callbackNonTracking,
|
callback: callbackNonTracking,
|
||||||
extraPrefs: [],
|
extraPrefs: [],
|
||||||
@ -169,6 +349,8 @@ this.AntiTracking = {
|
|||||||
name,
|
name,
|
||||||
cookieBehavior: BEHAVIOR_REJECT_TRACKER,
|
cookieBehavior: BEHAVIOR_REJECT_TRACKER,
|
||||||
blockingByContentBlocking: true,
|
blockingByContentBlocking: true,
|
||||||
|
blockingByContentBlockingUI: true,
|
||||||
|
blockingByContentBlockingRTUI: true,
|
||||||
allowList: true,
|
allowList: true,
|
||||||
callback: callbackNonTracking,
|
callback: callbackNonTracking,
|
||||||
extraPrefs: [],
|
extraPrefs: [],
|
||||||
@ -182,6 +364,8 @@ this.AntiTracking = {
|
|||||||
name,
|
name,
|
||||||
cookieBehavior: options.cookieBehavior,
|
cookieBehavior: options.cookieBehavior,
|
||||||
blockingByContentBlocking: options.blockingByContentBlocking,
|
blockingByContentBlocking: options.blockingByContentBlocking,
|
||||||
|
blockingByContentBlockingUI: options.blockingByContentBlockingUI,
|
||||||
|
blockingByContentBlockingRTUI: options.blockingByContentBlockingRTUI,
|
||||||
allowList: options.blockingByAllowList,
|
allowList: options.blockingByAllowList,
|
||||||
callback: callbackNonTracking,
|
callback: callbackNonTracking,
|
||||||
extraPrefs: [],
|
extraPrefs: [],
|
||||||
@ -210,11 +394,15 @@ this.AntiTracking = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
async _setupTest(win, cookieBehavior, blockingByContentBlocking, extraPrefs) {
|
async _setupTest(win, cookieBehavior, blockingByContentBlocking,
|
||||||
|
blockingByContentBlockingUI, blockingByContentBlockingRTUI,
|
||||||
|
extraPrefs) {
|
||||||
await SpecialPowers.flushPrefEnv();
|
await SpecialPowers.flushPrefEnv();
|
||||||
await SpecialPowers.pushPrefEnv({"set": [
|
await SpecialPowers.pushPrefEnv({"set": [
|
||||||
["dom.storage_access.enabled", true],
|
["dom.storage_access.enabled", true],
|
||||||
["browser.contentblocking.enabled", blockingByContentBlocking],
|
["browser.contentblocking.enabled", blockingByContentBlocking],
|
||||||
|
["browser.contentblocking.ui.enabled", blockingByContentBlockingUI],
|
||||||
|
["browser.contentblocking.rejecttrackers.ui.enabled", blockingByContentBlockingRTUI],
|
||||||
["network.cookie.cookieBehavior", cookieBehavior],
|
["network.cookie.cookieBehavior", cookieBehavior],
|
||||||
["privacy.trackingprotection.enabled", false],
|
["privacy.trackingprotection.enabled", false],
|
||||||
["privacy.trackingprotection.pbmode.enabled", false],
|
["privacy.trackingprotection.pbmode.enabled", false],
|
||||||
@ -233,7 +421,9 @@ this.AntiTracking = {
|
|||||||
_createTask(options) {
|
_createTask(options) {
|
||||||
add_task(async function() {
|
add_task(async function() {
|
||||||
info("Starting " + (options.cookieBehavior != BEHAVIOR_ACCEPT ? "blocking" : "non-blocking") + " cookieBehavior (" + options.cookieBehavior + ") and " +
|
info("Starting " + (options.cookieBehavior != BEHAVIOR_ACCEPT ? "blocking" : "non-blocking") + " cookieBehavior (" + options.cookieBehavior + ") and " +
|
||||||
(options.blockingByContentBlocking ? "blocking" : "non-blocking") + " contentBlocking with" +
|
(options.blockingByContentBlocking ? "blocking" : "non-blocking") + " contentBlocking and " +
|
||||||
|
(options.blockingByContentBlockingUI ? "" : "no") + " contentBlocking UI and " +
|
||||||
|
(options.blockingByContentBlockingRTUI ? "" : "no") + " contentBlocking third-party cookies UI with" +
|
||||||
(options.allowList ? "" : "out") + " allow list test " + options.name +
|
(options.allowList ? "" : "out") + " allow list test " + options.name +
|
||||||
" running in a " + (options.runInPrivateWindow ? "private" : "normal") + " window " +
|
" running in a " + (options.runInPrivateWindow ? "private" : "normal") + " window " +
|
||||||
" with iframe sandbox set to " + options.iframeSandbox);
|
" with iframe sandbox set to " + options.iframeSandbox);
|
||||||
@ -246,6 +436,8 @@ this.AntiTracking = {
|
|||||||
|
|
||||||
await AntiTracking._setupTest(win, options.cookieBehavior,
|
await AntiTracking._setupTest(win, options.cookieBehavior,
|
||||||
options.blockingByContentBlocking,
|
options.blockingByContentBlocking,
|
||||||
|
options.blockingByContentBlockingUI,
|
||||||
|
options.blockingByContentBlockingRTUI,
|
||||||
options.extraPrefs);
|
options.extraPrefs);
|
||||||
|
|
||||||
let cookieBlocked = 0;
|
let cookieBlocked = 0;
|
||||||
@ -355,7 +547,7 @@ this.AntiTracking = {
|
|||||||
await TestUtils.topicObserved("browser-delayed-startup-finished");
|
await TestUtils.topicObserved("browser-delayed-startup-finished");
|
||||||
}
|
}
|
||||||
|
|
||||||
await AntiTracking._setupTest(win, BEHAVIOR_REJECT_TRACKER, true, extraPrefs);
|
await AntiTracking._setupTest(win, BEHAVIOR_REJECT_TRACKER, true, true, true, extraPrefs);
|
||||||
|
|
||||||
info("Creating a new tab");
|
info("Creating a new tab");
|
||||||
let tab = BrowserTestUtils.addTab(win.gBrowser, TEST_TOP_PAGE);
|
let tab = BrowserTestUtils.addTab(win.gBrowser, TEST_TOP_PAGE);
|
||||||
@ -432,7 +624,7 @@ this.AntiTracking = {
|
|||||||
await TestUtils.topicObserved("browser-delayed-startup-finished");
|
await TestUtils.topicObserved("browser-delayed-startup-finished");
|
||||||
}
|
}
|
||||||
|
|
||||||
await AntiTracking._setupTest(win, BEHAVIOR_REJECT_TRACKER, true, extraPrefs);
|
await AntiTracking._setupTest(win, BEHAVIOR_REJECT_TRACKER, true, true, true, extraPrefs);
|
||||||
|
|
||||||
info("Creating a new tab");
|
info("Creating a new tab");
|
||||||
let tab = BrowserTestUtils.addTab(win.gBrowser, TEST_TOP_PAGE);
|
let tab = BrowserTestUtils.addTab(win.gBrowser, TEST_TOP_PAGE);
|
||||||
|
@ -24,6 +24,8 @@ AntiTracking.runTest("Image cache - should load the image twice.",
|
|||||||
runExtraTests: false,
|
runExtraTests: false,
|
||||||
cookieBehavior,
|
cookieBehavior,
|
||||||
blockingByContentBlocking,
|
blockingByContentBlocking,
|
||||||
|
blockingByContentBlockingUI,
|
||||||
|
blockingByContentBlockingRTUI,
|
||||||
blockingByAllowList,
|
blockingByAllowList,
|
||||||
callback: async _ => {
|
callback: async _ => {
|
||||||
// Let's load the image twice here as well.
|
// Let's load the image twice here as well.
|
||||||
|
Loading…
Reference in New Issue
Block a user