Bug 1486944 - Part 2: Add tests to ensure that the reject foreign cookie behavior also depends on the browser.contentblocking.enabled pref; r=baku

This commit is contained in:
Ehsan Akhgari 2018-08-28 18:36:05 -04:00
parent d1d402d14c
commit faefec50e9
3 changed files with 26 additions and 1 deletions

View File

@ -28,6 +28,7 @@ support-files = server.sjs
[browser_imageCache3.js]
[browser_imageCache4.js]
[browser_imageCache5.js]
[browser_imageCache6.js]
[browser_onBeforeRequestNotificationForTrackingResources.js]
[browser_onModifyRequestNotificationForTrackingResources.js]
[browser_subResources.js]

View File

@ -0,0 +1,15 @@
ChromeUtils.import("resource://gre/modules/Services.jsm");
let cookieBehavior = BEHAVIOR_REJECT_FOREIGN;
let blockingByContentBlocking = false;
let blockingByAllowList = 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);

View File

@ -53,7 +53,7 @@ this.AntiTracking = {
// Phase 1: Here we want to test that a 3rd party context is not blocked if pref is off.
if (runExtraTests) {
// There are four ways in which the third-party context may be blocked:
// There are four ways in which the third-party context may not be blocked:
// * If the cookieBehavior pref causes it to not be blocked.
// * If the contentBlocking pref causes it to not be blocked.
// * If both of these prefs cause it to not be blocked.
@ -62,9 +62,18 @@ this.AntiTracking = {
this._createTask(name, BEHAVIOR_ACCEPT, true, false, callbackNonTracking);
this._createCleanupTask(cleanupFunction);
this._createTask(name, BEHAVIOR_REJECT_FOREIGN, false, false, callbackNonTracking);
this._createCleanupTask(cleanupFunction);
this._createTask(name, BEHAVIOR_REJECT_TRACKER, false, false, callbackNonTracking);
this._createCleanupTask(cleanupFunction);
this._createTask(name, BEHAVIOR_REJECT_FOREIGN, false, true, callbackNonTracking);
this._createCleanupTask(cleanupFunction);
this._createTask(name, BEHAVIOR_REJECT_TRACKER, false, true, callbackNonTracking);
this._createCleanupTask(cleanupFunction);
this._createTask(name, BEHAVIOR_ACCEPT, false, false, callbackNonTracking);
this._createCleanupTask(cleanupFunction);