Backed out 5 changesets (bug 1486944, bug 1486926)for multiple failures on a CLOSED TREE
authorTiberius Oros <toros@mozilla.com>
Wed, 29 Aug 2018 16:50:15 +0300
changeset 482182 b6be51ee00aa8a2a18962d8074e804d5c75186e0
parent 482181 1a5c43f28e0675a36b3322233e16f9f9ad448548
child 482183 612ca23ddb81bfa32c2e53484f16e0076fe85841
push id232
push userfmarier@mozilla.com
push dateWed, 05 Sep 2018 20:45:54 +0000
bugs1486944, 1486926
milestone63.0a1
backs outb536e2deff083321e88293769360f3be8042baba
5fc45a7e2b354804b8bba3df9eafcbe3e6ddd00b
fef913dda33d078a92d24b526d6e047ca157634b
f6533c40954fc95bcd470a9e2662d928fe42df9e
20f625526901c263f3a3cf5bddae0dce664f93a7
Backed out 5 changesets (bug 1486944, bug 1486926)for multiple failures on a CLOSED TREE Backed out changeset b536e2deff08 (bug 1486944) Backed out changeset 5fc45a7e2b35 (bug 1486944) Backed out changeset fef913dda33d (bug 1486926) Backed out changeset f6533c40954f (bug 1486926) Backed out changeset 20f625526901 (bug 1486926)
netwerk/cookie/CookieServiceChild.cpp
netwerk/cookie/CookieServiceParent.cpp
netwerk/cookie/nsCookieService.cpp
toolkit/components/antitracking/AntiTrackingCommon.cpp
toolkit/components/antitracking/test/browser/browser.ini
toolkit/components/antitracking/test/browser/browser_imageCache1.js
toolkit/components/antitracking/test/browser/browser_imageCache2.js
toolkit/components/antitracking/test/browser/browser_imageCache3.js
toolkit/components/antitracking/test/browser/browser_imageCache4.js
toolkit/components/antitracking/test/browser/browser_imageCache5.js
toolkit/components/antitracking/test/browser/browser_imageCache6.js
toolkit/components/antitracking/test/browser/head.js
toolkit/components/antitracking/test/browser/imageCacheWorker.js
--- a/netwerk/cookie/CookieServiceChild.cpp
+++ b/netwerk/cookie/CookieServiceChild.cpp
@@ -178,20 +178,17 @@ CookieServiceChild::TrackCookieLoad(nsIC
   nsCOMPtr<nsIURI> uri;
   aChannel->GetURI(getter_AddRefs(uri));
   if (RequireThirdPartyCheck()) {
     mThirdPartyUtil->IsThirdPartyChannel(aChannel, uri, &isForeign);
   }
   nsCOMPtr<nsIHttpChannel> httpChannel = do_QueryInterface(aChannel);
   if (httpChannel) {
     isTrackingResource = httpChannel->GetIsTrackingResource();
-    // Check first-party storage access even for non-tracking resources, since
-    // we will need the result when computing the access rights for the reject
-    // foreign cookie behavior mode.
-    if (isForeign &&
+    if (isForeign && isTrackingResource &&
         AntiTrackingCommon::IsFirstPartyStorageAccessGrantedFor(httpChannel,
                                                                 uri)) {
       firstPartyStorageAccessGranted = true;
     }
   }
   nsCOMPtr<nsILoadInfo> loadInfo = aChannel->GetLoadInfo();
   mozilla::OriginAttributes attrs;
   if (loadInfo) {
@@ -579,20 +576,17 @@ CookieServiceChild::GetCookieStringInter
   if (RequireThirdPartyCheck())
     mThirdPartyUtil->IsThirdPartyChannel(aChannel, aHostURI, &isForeign);
 
   bool isTrackingResource = false;
   bool firstPartyStorageAccessGranted = false;
   nsCOMPtr<nsIHttpChannel> httpChannel = do_QueryInterface(aChannel);
   if (httpChannel) {
     isTrackingResource = httpChannel->GetIsTrackingResource();
-    // Check first-party storage access even for non-tracking resources, since
-    // we will need the result when computing the access rights for the reject
-    // foreign cookie behavior mode.
-    if (isForeign &&
+    if (isForeign && isTrackingResource &&
         AntiTrackingCommon::IsFirstPartyStorageAccessGrantedFor(httpChannel,
                                                                 aHostURI)) {
       firstPartyStorageAccessGranted = true;
     }
   }
 
   bool isSafeTopLevelNav = NS_IsSafeTopLevelNav(aChannel);
   bool isSameSiteForeign = NS_IsSameSiteForeign(aChannel, aHostURI);
@@ -639,20 +633,17 @@ CookieServiceChild::SetCookieStringInter
   if (RequireThirdPartyCheck())
     mThirdPartyUtil->IsThirdPartyChannel(aChannel, aHostURI, &isForeign);
 
   bool isTrackingResource = false;
   bool firstPartyStorageAccessGranted = false;
   nsCOMPtr<nsIHttpChannel> httpChannel = do_QueryInterface(aChannel);
   if (httpChannel) {
     isTrackingResource = httpChannel->GetIsTrackingResource();
-    // Check first-party storage access even for non-tracking resources, since
-    // we will need the result when computing the access rights for the reject
-    // foreign cookie behavior mode.
-    if (isForeign &&
+    if (isForeign && isTrackingResource &&
         AntiTrackingCommon::IsFirstPartyStorageAccessGrantedFor(httpChannel,
                                                                 aHostURI)) {
       firstPartyStorageAccessGranted = true;
     }
   }
 
   nsDependentCString cookieString(aCookieString);
   nsDependentCString stringServerTime;
--- a/netwerk/cookie/CookieServiceParent.cpp
+++ b/netwerk/cookie/CookieServiceParent.cpp
@@ -156,20 +156,17 @@ CookieServiceParent::TrackCookieLoad(nsI
   bool isForeign = true;
   thirdPartyUtil->IsThirdPartyChannel(aChannel, uri, &isForeign);
 
   bool isTrackingResource = false;
   bool storageAccessGranted = false;
   nsCOMPtr<nsIHttpChannel> httpChannel = do_QueryInterface(aChannel);
   if (httpChannel) {
     isTrackingResource = httpChannel->GetIsTrackingResource();
-    // Check first-party storage access even for non-tracking resources, since
-    // we will need the result when computing the access rights for the reject
-    // foreign cookie behavior mode.
-    if (isForeign &&
+    if (isForeign && isTrackingResource &&
         AntiTrackingCommon::IsFirstPartyStorageAccessGrantedFor(httpChannel,
                                                                 uri)) {
       storageAccessGranted = true;
     }
   }
 
   nsTArray<nsCookie*> foundCookieList;
   mCookieService->GetCookiesForURI(uri, isForeign, isTrackingResource,
--- a/netwerk/cookie/nsCookieService.cpp
+++ b/netwerk/cookie/nsCookieService.cpp
@@ -2040,20 +2040,17 @@ nsCookieService::GetCookieStringCommon(n
   mThirdPartyUtil->IsThirdPartyChannel(aChannel, aHostURI, &isForeign);
 
   bool isTrackingResource = false;
   bool firstPartyStorageAccessGranted = false;
   nsCOMPtr<nsIHttpChannel> httpChannel = do_QueryInterface(aChannel);
   if (httpChannel) {
     isTrackingResource = httpChannel->GetIsTrackingResource();
 
-    // Check first-party storage access even for non-tracking resources, since
-    // we will need the result when computing the access rights for the reject
-    // foreign cookie behavior mode.
-    if (isForeign &&
+    if (isForeign && isTrackingResource &&
         AntiTrackingCommon::IsFirstPartyStorageAccessGrantedFor(httpChannel,
                                                                 aHostURI)) {
       firstPartyStorageAccessGranted = true;
     }
   }
 
   OriginAttributes attrs;
   if (aChannel) {
@@ -2150,20 +2147,17 @@ nsCookieService::SetCookieStringCommon(n
   mThirdPartyUtil->IsThirdPartyChannel(aChannel, aHostURI, &isForeign);
 
   bool isTrackingResource = false;
   bool firstPartyStorageAccessGranted = false;
   nsCOMPtr<nsIHttpChannel> httpChannel = do_QueryInterface(aChannel);
   if (httpChannel) {
     isTrackingResource = httpChannel->GetIsTrackingResource();
 
-    // Check first-party storage access even for non-tracking resources, since
-    // we will need the result when computing the access rights for the reject
-    // foreign cookie behavior mode.
-    if (isForeign &&
+    if (isForeign && isTrackingResource &&
         AntiTrackingCommon::IsFirstPartyStorageAccessGrantedFor(httpChannel,
                                                                 aHostURI)) {
       firstPartyStorageAccessGranted = true;
     }
   }
 
   OriginAttributes attrs;
   if (aChannel) {
@@ -4260,35 +4254,31 @@ nsCookieService::CheckPrefs(nsICookiePer
   // check default prefs
   if (aCookieBehavior == nsICookieService::BEHAVIOR_REJECT) {
     COOKIE_LOGFAILURE(aCookieHeader ? SET_COOKIE : GET_COOKIE, aHostURI, aCookieHeader, "cookies are disabled");
     return STATUS_REJECTED;
   }
 
   // check if cookie is foreign
   if (aIsForeign) {
-    // Check aFirstPartyStorageAccessGranted when rejecting all third-party cookies,
-    // so that we take things such as the content blocking allow list into account.
-    if (aCookieBehavior == nsICookieService::BEHAVIOR_REJECT_FOREIGN &&
-        !aFirstPartyStorageAccessGranted) {
+    if (aCookieBehavior == nsICookieService::BEHAVIOR_REJECT_FOREIGN) {
       COOKIE_LOGFAILURE(aCookieHeader ? SET_COOKIE : GET_COOKIE, aHostURI, aCookieHeader, "context is third party");
       return STATUS_REJECTED;
     }
 
     if (aCookieBehavior == nsICookieService::BEHAVIOR_LIMIT_FOREIGN) {
       if (aNumOfCookies == 0) {
         COOKIE_LOGFAILURE(aCookieHeader ? SET_COOKIE : GET_COOKIE, aHostURI, aCookieHeader, "context is third party");
         return STATUS_REJECTED;
       }
     }
 
     MOZ_ASSERT(aCookieBehavior == nsICookieService::BEHAVIOR_ACCEPT ||
                aCookieBehavior == nsICookieService::BEHAVIOR_LIMIT_FOREIGN ||
                // But with permission granted.
-               aCookieBehavior == nsICookieService::BEHAVIOR_REJECT_FOREIGN ||
                aCookieBehavior == nsICookieService::BEHAVIOR_REJECT_TRACKER);
 
     if (aThirdPartySession)
       return STATUS_ACCEPT_SESSION;
 
     if (aThirdPartyNonsecureSession) {
       bool isHTTPS = false;
       aHostURI->SchemeIs("https", &isHTTPS);
--- a/toolkit/components/antitracking/AntiTrackingCommon.cpp
+++ b/toolkit/components/antitracking/AntiTrackingCommon.cpp
@@ -368,30 +368,16 @@ AntiTrackingCommon::IsFirstPartyStorageA
   }
 
   // Let's check if this is a 3rd party context.
   if (!nsContentUtils::IsThirdPartyWindowOrChannel(aWindow, nullptr, aURI)) {
     LOG(("Our window isn't a third-party window"));
     return true;
   }
 
-  if (behavior == nsICookieService::BEHAVIOR_REJECT_FOREIGN) {
-    // Now, we have to also honour the Content Blocking pref.
-    if (!StaticPrefs::browser_contentblocking_enabled()) {
-      LOG(("The content blocking pref has been disabled, bail out early by "
-           "by pretending our window isn't a third-party window"));
-      return true;
-    }
-
-    if (CheckContentBlockingAllowList(aWindow)) {
-      LOG(("Allowing access even though our behavior is reject foreign"));
-      return true;
-    }
-  }
-
   if (behavior == nsICookieService::BEHAVIOR_REJECT_FOREIGN ||
       behavior == nsICookieService::BEHAVIOR_LIMIT_FOREIGN) {
     // XXX For non-cookie forms of storage, we handle BEHAVIOR_LIMIT_FOREIGN by
     // simply rejecting the request to use the storage. In the future, if we
     // change the meaning of BEHAVIOR_LIMIT_FOREIGN to be one which makes sense
     // for non-cookie storage types, this may change.
     LOG(("Nothing more to do due to the behavior code %d", int(behavior)));
     return false;
@@ -553,30 +539,16 @@ AntiTrackingCommon::IsFirstPartyStorageA
                                                 nullptr,
                                                 &thirdParty);
   // Grant if it's not a 3rd party.
   if (!thirdParty) {
     LOG(("Our channel isn't a third-party channel"));
     return true;
   }
 
-  if (behavior == nsICookieService::BEHAVIOR_REJECT_FOREIGN) {
-    // Now, we have to also honour the Content Blocking pref.
-    if (!StaticPrefs::browser_contentblocking_enabled()) {
-      LOG(("The content blocking pref has been disabled, bail out early by "
-           "by pretending our window isn't a third-party window"));
-      return true;
-    }
-
-    if (CheckContentBlockingAllowList(aChannel)) {
-      LOG(("Allowing access even though our behavior is reject foreign"));
-      return true;
-    }
-  }
-
   if (behavior == nsICookieService::BEHAVIOR_REJECT_FOREIGN ||
       behavior == nsICookieService::BEHAVIOR_LIMIT_FOREIGN) {
     // XXX For non-cookie forms of storage, we handle BEHAVIOR_LIMIT_FOREIGN by
     // simply rejecting the request to use the storage. In the future, if we
     // change the meaning of BEHAVIOR_LIMIT_FOREIGN to be one which makes sense
     // for non-cookie storage types, this may change.
     LOG(("Nothing more to do due to the behavior code %d", int(behavior)));
     return false;
--- a/toolkit/components/antitracking/test/browser/browser.ini
+++ b/toolkit/components/antitracking/test/browser/browser.ini
@@ -22,16 +22,14 @@ support-files = server.sjs
 [browser_blockingWorkers.js]
 [browser_blockingMessaging.js]
 [browser_blockingNoOpener.js]
 [browser_existingCookiesForSubresources.js]
 [browser_imageCache1.js]
 [browser_imageCache2.js]
 [browser_imageCache3.js]
 [browser_imageCache4.js]
-[browser_imageCache5.js]
-[browser_imageCache6.js]
 [browser_onBeforeRequestNotificationForTrackingResources.js]
 [browser_onModifyRequestNotificationForTrackingResources.js]
 [browser_subResources.js]
 support-files = subResources.sjs
 [browser_script.js]
 support-files = tracker.js
--- a/toolkit/components/antitracking/test/browser/browser_imageCache1.js
+++ b/toolkit/components/antitracking/test/browser/browser_imageCache1.js
@@ -1,11 +1,11 @@
 ChromeUtils.import("resource://gre/modules/Services.jsm");
 
-let cookieBehavior = BEHAVIOR_REJECT_TRACKER;
+let blockingByCookieBehavior = true;
 let blockingByContentBlocking = false;
 let blockingByAllowList = false;
 
 let rootDir = getRootDirectory(gTestPath);
 let jar = getJar(rootDir);
 if (jar) {
   let tmpdir = extractJarToTmp(jar);
   rootDir = "file://" + tmpdir.path + "/";
--- a/toolkit/components/antitracking/test/browser/browser_imageCache2.js
+++ b/toolkit/components/antitracking/test/browser/browser_imageCache2.js
@@ -1,11 +1,11 @@
 ChromeUtils.import("resource://gre/modules/Services.jsm");
 
-let cookieBehavior = BEHAVIOR_REJECT_TRACKER;
+let blockingByCookieBehavior = false;
 let blockingByContentBlocking = true;
 let blockingByAllowList = false;
 
 let rootDir = getRootDirectory(gTestPath);
 let jar = getJar(rootDir);
 if (jar) {
   let tmpdir = extractJarToTmp(jar);
   rootDir = "file://" + tmpdir.path + "/";
--- a/toolkit/components/antitracking/test/browser/browser_imageCache3.js
+++ b/toolkit/components/antitracking/test/browser/browser_imageCache3.js
@@ -1,11 +1,11 @@
 ChromeUtils.import("resource://gre/modules/Services.jsm");
 
-let cookieBehavior = BEHAVIOR_REJECT_TRACKER;
+let blockingByCookieBehavior = false;
 let blockingByContentBlocking = false;
 let blockingByAllowList = false;
 
 let rootDir = getRootDirectory(gTestPath);
 let jar = getJar(rootDir);
 if (jar) {
   let tmpdir = extractJarToTmp(jar);
   rootDir = "file://" + tmpdir.path + "/";
--- a/toolkit/components/antitracking/test/browser/browser_imageCache4.js
+++ b/toolkit/components/antitracking/test/browser/browser_imageCache4.js
@@ -1,11 +1,11 @@
 ChromeUtils.import("resource://gre/modules/Services.jsm");
 
-let cookieBehavior = BEHAVIOR_REJECT_TRACKER;
+let blockingByCookieBehavior = true;
 let blockingByContentBlocking = true;
 let blockingByAllowList = true;
 
 let rootDir = getRootDirectory(gTestPath);
 let jar = getJar(rootDir);
 if (jar) {
   let tmpdir = extractJarToTmp(jar);
   rootDir = "file://" + tmpdir.path + "/";
deleted file mode 100644
--- a/toolkit/components/antitracking/test/browser/browser_imageCache5.js
+++ /dev/null
@@ -1,15 +0,0 @@
-ChromeUtils.import("resource://gre/modules/Services.jsm");
-
-let cookieBehavior = BEHAVIOR_REJECT_FOREIGN;
-let blockingByContentBlocking = true;
-let blockingByAllowList = 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);
-
deleted file mode 100644
--- a/toolkit/components/antitracking/test/browser/browser_imageCache6.js
+++ /dev/null
@@ -1,15 +0,0 @@
-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);
-
--- a/toolkit/components/antitracking/test/browser/head.js
+++ b/toolkit/components/antitracking/test/browser/head.js
@@ -7,40 +7,37 @@ const TEST_PATH = "browser/toolkit/compo
 const TEST_TOP_PAGE = TEST_DOMAIN + TEST_PATH + "page.html";
 const TEST_EMBEDDER_PAGE = TEST_DOMAIN + TEST_PATH + "embedder.html";
 const TEST_POPUP_PAGE = TEST_DOMAIN + TEST_PATH + "popup.html";
 const TEST_3RD_PARTY_PAGE = TEST_3RD_PARTY_DOMAIN + TEST_PATH + "3rdParty.html";
 const TEST_3RD_PARTY_PAGE_WO = TEST_3RD_PARTY_DOMAIN + TEST_PATH + "3rdPartyWO.html";
 const TEST_3RD_PARTY_PAGE_UI = TEST_3RD_PARTY_DOMAIN + TEST_PATH + "3rdPartyUI.html";
 const TEST_3RD_PARTY_PAGE_WITH_SVG = TEST_3RD_PARTY_DOMAIN + TEST_PATH + "3rdPartySVG.html";
 
-const BEHAVIOR_ACCEPT         = Ci.nsICookieService.BEHAVIOR_ACCEPT;
-const BEHAVIOR_REJECT_FOREIGN = Ci.nsICookieService.BEHAVIOR_REJECT_FOREIGN;
-const BEHAVIOR_REJECT_TRACKER = Ci.nsICookieService.BEHAVIOR_REJECT_TRACKER;
-
 var gFeatures = undefined;
 
 let {UrlClassifierTestUtils} = ChromeUtils.import("resource://testing-common/UrlClassifierTestUtils.jsm", {});
 
 this.AntiTracking = {
   runTest(name, callbackTracking, callbackNonTracking, cleanupFunction, extraPrefs, windowOpenTest = true, userInteractionTest = true) {
     // Here we want to test that a 3rd party context is simply blocked.
     this._createTask(name, true, true, false, callbackTracking, extraPrefs);
     this._createCleanupTask(cleanupFunction);
 
     if (callbackNonTracking) {
       let runExtraTests = true;
       let options = {};
       if (typeof callbackNonTracking == "object") {
         callbackNonTracking = callbackNonTracking.callback;
         runExtraTests = callbackNonTracking.runExtraTests;
-        if ("cookieBehavior" in callbackNonTracking) {
-          options.cookieBehavior = callbackNonTracking.cookieBehavior;
+        if ("blockingByCookieBehavior" in callbackNonTracking) {
+          options.blockingByCookieBehavior =
+            callbackNonTracking.blockingByCookieBehavior;
         } else {
-          options.cookieBehavior = BEHAVIOR_ACCEPT;
+          options.blockingByCookieBehavior = false;
         }
         if ("blockingByContentBlocking" in callbackNonTracking) {
           options.blockingByContentBlocking =
             callbackNonTracking.blockingByContentBlocking;
         } else {
           options.blockingByContentBlocking = false;
         }
         if ("blockingByAllowList" in callbackNonTracking) {
@@ -48,48 +45,35 @@ this.AntiTracking = {
             callbackNonTracking.blockingByAllowList;
         } else {
           options.blockingByAllowList = false;
         }
       }
 
       // 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 not be blocked:
+        // There are four ways in which the third-party context may 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.
         //   * If the top-level page is on the content blocking allow list.
         // All of these cases are tested here.
-        this._createTask(name, BEHAVIOR_ACCEPT, true, false, callbackNonTracking);
+        this._createTask(name, false, 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._createTask(name, true, false, false, 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._createTask(name, false, false, false, callbackNonTracking);
         this._createCleanupTask(cleanupFunction);
 
-        // Try testing using the allow list with both reject foreign and reject tracker cookie behaviors
-        this._createTask(name, BEHAVIOR_REJECT_FOREIGN, true, true, callbackNonTracking);
-        this._createCleanupTask(cleanupFunction);
-
-        this._createTask(name, BEHAVIOR_REJECT_TRACKER, true, true, callbackNonTracking);
+        this._createTask(name, true, true, true, callbackNonTracking);
         this._createCleanupTask(cleanupFunction);
       } else {
-        this._createTask(name, options.cookieBehavior,
+        this._createTask(name, options.blockingByCookieBehavior,
                          options.blockingByContentBlocking,
                          options.blockingByAllowList,
                          callbackNonTracking);
         this._createCleanupTask(cleanupFunction);
       }
 
       // Phase 2: Here we want to test that a third-party context doesn't
       // get blocked with when the same origin is opened through window.open().
@@ -102,42 +86,42 @@ this.AntiTracking = {
       // get blocked with user interaction present
       if (userInteractionTest) {
         this._createUserInteractionTask(name, callbackTracking, callbackNonTracking, extraPrefs);
         this._createCleanupTask(cleanupFunction);
       }
     }
   },
 
-  async _setupTest(cookieBehavior, blockingByContentBlocking, extraPrefs) {
+  async _setupTest(blockingByCookieBehavior, blockingByContentBlocking, extraPrefs) {
     await SpecialPowers.flushPrefEnv();
     await SpecialPowers.pushPrefEnv({"set": [
       ["browser.contentblocking.enabled", blockingByContentBlocking],
-      ["network.cookie.cookieBehavior", cookieBehavior],
+      ["network.cookie.cookieBehavior", blockingByCookieBehavior ? Ci.nsICookieService.BEHAVIOR_REJECT_TRACKER : Ci.nsICookieService.BEHAVIOR_ACCEPT],
       ["privacy.trackingprotection.enabled", false],
       ["privacy.trackingprotection.pbmode.enabled", false],
-      ["privacy.trackingprotection.annotate_channels", cookieBehavior != BEHAVIOR_ACCEPT],
+      ["privacy.trackingprotection.annotate_channels", blockingByCookieBehavior],
       [ContentBlocking.prefIntroCount, ContentBlocking.MAX_INTROS],
     ]});
 
     if (extraPrefs && Array.isArray(extraPrefs) && extraPrefs.length) {
       await SpecialPowers.pushPrefEnv({"set": extraPrefs });
     }
 
     await UrlClassifierTestUtils.addTestTrackers();
   },
 
-  _createTask(name, cookieBehavior, blockingByContentBlocking,
+  _createTask(name, blockingByCookieBehavior, blockingByContentBlocking,
               allowList, callback, extraPrefs) {
     add_task(async function() {
-      info("Starting " + (cookieBehavior != BEHAVIOR_ACCEPT ? "blocking" : "non-blocking") + " cookieBehavior (" + cookieBehavior + ") and " +
+      info("Starting " + (blockingByCookieBehavior ? "blocking" : "non-blocking") + " cookieBehavior and " +
                          (blockingByContentBlocking ? "blocking" : "non-blocking") + " contentBlocking with" +
                          (allowList ? "" : "out") + " allow list test " + name);
 
-      await AntiTracking._setupTest(cookieBehavior, blockingByContentBlocking, extraPrefs);
+      await AntiTracking._setupTest(blockingByCookieBehavior, blockingByContentBlocking, extraPrefs);
 
       info("Creating a new tab");
       let tab = BrowserTestUtils.addTab(gBrowser, TEST_TOP_PAGE);
       gBrowser.selectedTab = tab;
 
       let browser = gBrowser.getBrowserForTab(tab);
       await BrowserTestUtils.browserLoaded(browser);
 
@@ -206,17 +190,17 @@ this.AntiTracking = {
         await cleanupFunction();
       }
     });
   },
 
   _createWindowOpenTask(name, blockingCallback, nonBlockingCallback, extraPrefs) {
     add_task(async function() {
       info("Starting window-open test " + name);
-      await AntiTracking._setupTest(BEHAVIOR_REJECT_TRACKER, true, extraPrefs);
+      await AntiTracking._setupTest(true, true, extraPrefs);
 
       info("Creating a new tab");
       let tab = BrowserTestUtils.addTab(gBrowser, TEST_TOP_PAGE);
       gBrowser.selectedTab = tab;
 
       let browser = gBrowser.getBrowserForTab(tab);
       await BrowserTestUtils.browserLoaded(browser);
 
@@ -267,17 +251,17 @@ this.AntiTracking = {
       info("Removing the tab");
       BrowserTestUtils.removeTab(tab);
     });
   },
 
   _createUserInteractionTask(name, blockingCallback, nonBlockingCallback, extraPrefs) {
     add_task(async function() {
       info("Starting user-interaction test " + name);
-      await AntiTracking._setupTest(BEHAVIOR_REJECT_TRACKER, true, extraPrefs);
+      await AntiTracking._setupTest(true, true, extraPrefs);
 
       info("Creating a new tab");
       let tab = BrowserTestUtils.addTab(gBrowser, TEST_TOP_PAGE);
       gBrowser.selectedTab = tab;
 
       let browser = gBrowser.getBrowserForTab(tab);
       await BrowserTestUtils.browserLoaded(browser);
 
--- a/toolkit/components/antitracking/test/browser/imageCacheWorker.js
+++ b/toolkit/components/antitracking/test/browser/imageCacheWorker.js
@@ -17,17 +17,17 @@ AntiTracking.runTest("Image cache - shou
     img.src = "https://tracking.example.org/browser/toolkit/components/antitracking/test/browser/image.sjs",
     await new Promise(resolve => { img.onload = resolve; });
     ok(true, "Image 2 loaded");
   },
 
   // non-blocking callback
   {
     runExtraTests: false,
-    cookieBehavior,
+    blockingByCookieBehavior,
     blockingByContentBlocking,
     blockingByAllowList,
     callback: async _ => {
       // Let's load the image twice here as well.
       let img = document.createElement("img");
       document.body.appendChild(img);
       img.src = "https://tracking.example.org/browser/toolkit/components/antitracking/test/browser/image.sjs",
       await new Promise(resolve => { img.onload = resolve; });