Bug 1493682 - Part 3: Add tests for the new prefs r=baku
☠☠ backed out by 79125b42f1be ☠ ☠
authorEhsan Akhgari <ehsan@mozilla.com>
Tue, 25 Sep 2018 05:40:16 +0000
changeset 490081 ed8bf630148784ce92932e138e8cff676794956d
parent 490080 bf1fb942d5ccc1588a7053429c86e15d20ba930e
child 490082 41b9ef81d9fa1af3f8d0c9529ffe30db449aed62
push id9898
push usereakhgari@mozilla.com
push dateThu, 27 Sep 2018 02:59:46 +0000
treeherdermozilla-beta@41b9ef81d9fa [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbaku
bugs1493682
milestone63.0
Bug 1493682 - Part 3: Add tests for the new prefs r=baku The image cache tests didn't follow the previous naming convention in order to make it clearer how the tests are set up using the naming conventions of the files. These tests should be unified into a single file soon. Depends on D6748 Differential Revision: https://phabricator.services.mozilla.com/D6749
toolkit/components/antitracking/test/browser/browser.ini
toolkit/components/antitracking/test/browser/browser_imageCache1-1.js
toolkit/components/antitracking/test/browser/browser_imageCache1-2.js
toolkit/components/antitracking/test/browser/browser_imageCache10-1.js
toolkit/components/antitracking/test/browser/browser_imageCache10-2.js
toolkit/components/antitracking/test/browser/browser_imageCache11-1.js
toolkit/components/antitracking/test/browser/browser_imageCache11-2.js
toolkit/components/antitracking/test/browser/browser_imageCache12.js
toolkit/components/antitracking/test/browser/browser_imageCache13-1.js
toolkit/components/antitracking/test/browser/browser_imageCache13-2.js
toolkit/components/antitracking/test/browser/browser_imageCache14-1.js
toolkit/components/antitracking/test/browser/browser_imageCache14-2.js
toolkit/components/antitracking/test/browser/browser_imageCache15.js
toolkit/components/antitracking/test/browser/browser_imageCache2-1.js
toolkit/components/antitracking/test/browser/browser_imageCache2-2.js
toolkit/components/antitracking/test/browser/browser_imageCache3.js
toolkit/components/antitracking/test/browser/browser_imageCache4-1.js
toolkit/components/antitracking/test/browser/browser_imageCache4-2.js
toolkit/components/antitracking/test/browser/browser_imageCache5-1.js
toolkit/components/antitracking/test/browser/browser_imageCache5-2.js
toolkit/components/antitracking/test/browser/browser_imageCache6-1.js
toolkit/components/antitracking/test/browser/browser_imageCache6-2.js
toolkit/components/antitracking/test/browser/head.js
toolkit/components/antitracking/test/browser/imageCacheWorker.js
--- a/toolkit/components/antitracking/test/browser/browser.ini
+++ b/toolkit/components/antitracking/test/browser/browser.ini
@@ -19,29 +19,44 @@ support-files =
 support-files = server.sjs
 [browser_blockingIndexedDb.js]
 [browser_blockingStorage.js]
 [browser_blockingWorkers.js]
 [browser_blockingMessaging.js]
 [browser_blockingNoOpener.js]
 [browser_existingCookiesForSubresources.js]
 [browser_imageCache1.js]
+[browser_imageCache1-1.js]
+[browser_imageCache1-2.js]
 [browser_imageCache2.js]
-[browser_imageCache3.js]
+[browser_imageCache2-1.js]
+[browser_imageCache2-2.js]
 [browser_imageCache4.js]
+[browser_imageCache4-1.js]
+[browser_imageCache4-2.js]
 [browser_imageCache5.js]
+[browser_imageCache5-1.js]
+[browser_imageCache5-2.js]
+[browser_imageCache6-1.js]
+[browser_imageCache6-2.js]
 [browser_imageCache6.js]
 [browser_imageCache8.js]
 [browser_imageCache9.js]
 [browser_imageCache10.js]
+[browser_imageCache10-1.js]
+[browser_imageCache10-2.js]
 [browser_imageCache11.js]
-[browser_imageCache12.js]
+[browser_imageCache11-1.js]
+[browser_imageCache11-2.js]
 [browser_imageCache13.js]
+[browser_imageCache13-1.js]
+[browser_imageCache13-2.js]
 [browser_imageCache14.js]
-[browser_imageCache15.js]
+[browser_imageCache14-1.js]
+[browser_imageCache14-2.js]
 [browser_onBeforeRequestNotificationForTrackingResources.js]
 [browser_onModifyRequestNotificationForTrackingResources.js]
 [browser_permissionInNormalWindows.js]
 [browser_permissionInPrivateWindows.js]
 [browser_subResources.js]
 support-files = subResources.sjs
 [browser_script.js]
 support-files = tracker.js
new file mode 100644
--- /dev/null
+++ b/toolkit/components/antitracking/test/browser/browser_imageCache1-1.js
@@ -0,0 +1,18 @@
+ChromeUtils.import("resource://gre/modules/Services.jsm");
+
+let cookieBehavior = BEHAVIOR_REJECT_TRACKER;
+let blockingByContentBlocking = false;
+let blockingByContentBlockingUI = true;
+let blockingByContentBlockingRTUI = false;
+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);
+
rename from toolkit/components/antitracking/test/browser/browser_imageCache3.js
rename to toolkit/components/antitracking/test/browser/browser_imageCache1-2.js
new file mode 100644
--- /dev/null
+++ b/toolkit/components/antitracking/test/browser/browser_imageCache10-1.js
@@ -0,0 +1,18 @@
+ChromeUtils.import("resource://gre/modules/Services.jsm");
+
+let cookieBehavior = BEHAVIOR_REJECT_FOREIGN;
+let blockingByContentBlocking = false;
+let blockingByContentBlockingUI = true;
+let blockingByContentBlockingRTUI = false;
+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);
+
new file mode 100644
--- /dev/null
+++ b/toolkit/components/antitracking/test/browser/browser_imageCache10-2.js
@@ -0,0 +1,18 @@
+ChromeUtils.import("resource://gre/modules/Services.jsm");
+
+let cookieBehavior = BEHAVIOR_REJECT_FOREIGN;
+let blockingByContentBlocking = false;
+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);
+
new file mode 100644
--- /dev/null
+++ b/toolkit/components/antitracking/test/browser/browser_imageCache11-1.js
@@ -0,0 +1,18 @@
+ChromeUtils.import("resource://gre/modules/Services.jsm");
+
+let cookieBehavior = BEHAVIOR_REJECT_FOREIGN;
+let blockingByContentBlocking = true;
+let blockingByContentBlockingUI = false;
+let blockingByContentBlockingRTUI = false;
+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);
+
new file mode 100644
--- /dev/null
+++ b/toolkit/components/antitracking/test/browser/browser_imageCache11-2.js
@@ -0,0 +1,18 @@
+ChromeUtils.import("resource://gre/modules/Services.jsm");
+
+let cookieBehavior = BEHAVIOR_REJECT_FOREIGN;
+let blockingByContentBlocking = true;
+let blockingByContentBlockingUI = false;
+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);
+
deleted file mode 100644
--- a/toolkit/components/antitracking/test/browser/browser_imageCache12.js
+++ /dev/null
@@ -1,18 +0,0 @@
-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);
-
new file mode 100644
--- /dev/null
+++ b/toolkit/components/antitracking/test/browser/browser_imageCache13-1.js
@@ -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 = false;
+let blockingByAllowList = true;
+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);
new file mode 100644
--- /dev/null
+++ b/toolkit/components/antitracking/test/browser/browser_imageCache13-2.js
@@ -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 = 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);
new file mode 100644
--- /dev/null
+++ b/toolkit/components/antitracking/test/browser/browser_imageCache14-1.js
@@ -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 = false;
+let blockingByAllowList = true;
+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);
new file mode 100644
--- /dev/null
+++ b/toolkit/components/antitracking/test/browser/browser_imageCache14-2.js
@@ -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 = 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);
deleted file mode 100644
--- a/toolkit/components/antitracking/test/browser/browser_imageCache15.js
+++ /dev/null
@@ -1,21 +0,0 @@
-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);
new file mode 100644
--- /dev/null
+++ b/toolkit/components/antitracking/test/browser/browser_imageCache2-1.js
@@ -0,0 +1,18 @@
+ChromeUtils.import("resource://gre/modules/Services.jsm");
+
+let cookieBehavior = BEHAVIOR_REJECT_TRACKER;
+let blockingByContentBlocking = true;
+let blockingByContentBlockingUI = false;
+let blockingByContentBlockingRTUI = false;
+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);
+
new file mode 100644
--- /dev/null
+++ b/toolkit/components/antitracking/test/browser/browser_imageCache2-2.js
@@ -0,0 +1,18 @@
+ChromeUtils.import("resource://gre/modules/Services.jsm");
+
+let cookieBehavior = BEHAVIOR_REJECT_TRACKER;
+let blockingByContentBlocking = true;
+let blockingByContentBlockingUI = false;
+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);
+
new file mode 100644
--- /dev/null
+++ b/toolkit/components/antitracking/test/browser/browser_imageCache4-1.js
@@ -0,0 +1,18 @@
+ChromeUtils.import("resource://gre/modules/Services.jsm");
+
+let cookieBehavior = BEHAVIOR_REJECT_TRACKER;
+let blockingByContentBlocking = true;
+let blockingByContentBlockingUI = true;
+let blockingByContentBlockingRTUI = false;
+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);
+
copy from toolkit/components/antitracking/test/browser/browser_imageCache3.js
copy to toolkit/components/antitracking/test/browser/browser_imageCache4-2.js
new file mode 100644
--- /dev/null
+++ b/toolkit/components/antitracking/test/browser/browser_imageCache5-1.js
@@ -0,0 +1,18 @@
+ChromeUtils.import("resource://gre/modules/Services.jsm");
+
+let cookieBehavior = BEHAVIOR_REJECT_TRACKER;
+let blockingByContentBlocking = false;
+let blockingByContentBlockingUI = true;
+let blockingByContentBlockingRTUI = false;
+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);
+
copy from toolkit/components/antitracking/test/browser/browser_imageCache3.js
copy to toolkit/components/antitracking/test/browser/browser_imageCache5-2.js
new file mode 100644
--- /dev/null
+++ b/toolkit/components/antitracking/test/browser/browser_imageCache6-1.js
@@ -0,0 +1,18 @@
+ChromeUtils.import("resource://gre/modules/Services.jsm");
+
+let cookieBehavior = BEHAVIOR_REJECT_TRACKER;
+let blockingByContentBlocking = true;
+let blockingByContentBlockingUI = false;
+let blockingByContentBlockingRTUI = false;
+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);
+
new file mode 100644
--- /dev/null
+++ b/toolkit/components/antitracking/test/browser/browser_imageCache6-2.js
@@ -0,0 +1,18 @@
+ChromeUtils.import("resource://gre/modules/Services.jsm");
+
+let cookieBehavior = BEHAVIOR_REJECT_TRACKER;
+let blockingByContentBlocking = true;
+let blockingByContentBlockingUI = false;
+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);
+
--- a/toolkit/components/antitracking/test/browser/head.js
+++ b/toolkit/components/antitracking/test/browser/head.js
@@ -36,16 +36,30 @@ this.AntiTracking = {
       allowList: false,
       callback: callbackTracking,
       extraPrefs,
       expectedBlockingNotifications,
       runInPrivateWindow,
     });
     this._createCleanupTask(cleanupFunction);
 
+    this._createTask({
+      name,
+      cookieBehavior: BEHAVIOR_REJECT_TRACKER,
+      blockingByContentBlocking: true,
+      blockingByContentBlockingUI: true,
+      blockingByContentBlockingRTUI: false,
+      allowList: true,
+      callback: callbackTracking,
+      extraPrefs,
+      expectedBlockingNotifications,
+      runInPrivateWindow,
+    });
+    this._createCleanupTask(cleanupFunction);
+
     if (callbackNonTracking) {
       let runExtraTests = true;
       let options = {};
       if (typeof callbackNonTracking == "object") {
         options.callback = callbackNonTracking.callback;
         runExtraTests = callbackNonTracking.runExtraTests;
         if ("cookieBehavior" in callbackNonTracking) {
           options.cookieBehavior = callbackNonTracking.cookieBehavior;
@@ -80,19 +94,19 @@ 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 six 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 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 the top-level page is on the content blocking allow list.
+        //   * If the contentBlocking third-party cookies UI pref is off, the allow list will be ignored.
         // All of these cases are tested here.
         this._createTask({
           name,
           cookieBehavior: BEHAVIOR_ACCEPT,
           blockingByContentBlocking: true,
           blockingByContentBlockingUI: true,
           blockingByContentBlockingRTUI: true,
           allowList: false,
@@ -100,47 +114,117 @@ this.AntiTracking = {
           extraPrefs: [],
           expectedBlockingNotifications: false,
           runInPrivateWindow,
         });
         this._createCleanupTask(cleanupFunction);
 
         this._createTask({
           name,
+          cookieBehavior: BEHAVIOR_ACCEPT,
+          blockingByContentBlocking: true,
+          blockingByContentBlockingUI: true,
+          blockingByContentBlockingRTUI: false,
+          allowList: true,
+          callback: callbackNonTracking,
+          extraPrefs: [],
+          expectedBlockingNotifications: false,
+          runInPrivateWindow,
+        });
+        this._createCleanupTask(cleanupFunction);
+
+        this._createTask({
+          name,
+          cookieBehavior: BEHAVIOR_ACCEPT,
+          blockingByContentBlocking: true,
+          blockingByContentBlockingUI: true,
+          blockingByContentBlockingRTUI: false,
+          allowList: false,
+          callback: callbackNonTracking,
+          extraPrefs: [],
+          expectedBlockingNotifications: false,
+          runInPrivateWindow,
+        });
+        this._createCleanupTask(cleanupFunction);
+
+        this._createTask({
+          name,
           cookieBehavior: BEHAVIOR_REJECT_FOREIGN,
           blockingByContentBlocking: false,
           blockingByContentBlockingUI: true,
           blockingByContentBlockingRTUI: true,
           allowList: false,
           callback: callbackNonTracking,
           extraPrefs: [],
           expectedBlockingNotifications: false,
           runInPrivateWindow,
         });
         this._createCleanupTask(cleanupFunction);
 
         this._createTask({
           name,
           cookieBehavior: BEHAVIOR_REJECT_FOREIGN,
+          blockingByContentBlocking: false,
+          blockingByContentBlockingUI: true,
+          blockingByContentBlockingRTUI: false,
+          allowList: true,
+          callback: callbackNonTracking,
+          extraPrefs: [],
+          expectedBlockingNotifications: false,
+          runInPrivateWindow,
+        });
+        this._createCleanupTask(cleanupFunction);
+
+        this._createTask({
+          name,
+          cookieBehavior: BEHAVIOR_REJECT_FOREIGN,
+          blockingByContentBlocking: false,
+          blockingByContentBlockingUI: true,
+          blockingByContentBlockingRTUI: false,
+          allowList: false,
+          callback: callbackNonTracking,
+          extraPrefs: [],
+          expectedBlockingNotifications: false,
+          runInPrivateWindow,
+        });
+        this._createCleanupTask(cleanupFunction);
+
+        this._createTask({
+          name,
+          cookieBehavior: BEHAVIOR_REJECT_FOREIGN,
           blockingByContentBlocking: true,
           blockingByContentBlockingUI: false,
           blockingByContentBlockingRTUI: true,
           allowList: false,
           callback: callbackNonTracking,
           extraPrefs: [],
           expectedBlockingNotifications: false,
           runInPrivateWindow,
         });
         this._createCleanupTask(cleanupFunction);
 
         this._createTask({
           name,
           cookieBehavior: BEHAVIOR_REJECT_FOREIGN,
           blockingByContentBlocking: true,
-          blockingByContentBlockingUI: true,
+          blockingByContentBlockingUI: false,
+          blockingByContentBlockingRTUI: false,
+          allowList: true,
+          callback: callbackNonTracking,
+          extraPrefs: [],
+          expectedBlockingNotifications: false,
+          runInPrivateWindow,
+        });
+        this._createCleanupTask(cleanupFunction);
+
+        this._createTask({
+          name,
+          cookieBehavior: BEHAVIOR_REJECT_FOREIGN,
+          blockingByContentBlocking: true,
+          blockingByContentBlockingUI: false,
           blockingByContentBlockingRTUI: false,
           allowList: false,
           callback: callbackNonTracking,
           extraPrefs: [],
           expectedBlockingNotifications: false,
           runInPrivateWindow,
         });
         this._createCleanupTask(cleanupFunction);
@@ -157,32 +241,74 @@ this.AntiTracking = {
           expectedBlockingNotifications: false,
           runInPrivateWindow,
         });
         this._createCleanupTask(cleanupFunction);
 
         this._createTask({
           name,
           cookieBehavior: BEHAVIOR_REJECT_TRACKER,
+          blockingByContentBlocking: false,
+          blockingByContentBlockingUI: true,
+          blockingByContentBlockingRTUI: false,
+          allowList: true,
+          callback: callbackNonTracking,
+          extraPrefs: [],
+          expectedBlockingNotifications: false,
+          runInPrivateWindow,
+        });
+        this._createCleanupTask(cleanupFunction);
+
+        this._createTask({
+          name,
+          cookieBehavior: BEHAVIOR_REJECT_TRACKER,
+          blockingByContentBlocking: false,
+          blockingByContentBlockingUI: true,
+          blockingByContentBlockingRTUI: false,
+          allowList: false,
+          callback: callbackNonTracking,
+          extraPrefs: [],
+          expectedBlockingNotifications: false,
+          runInPrivateWindow,
+        });
+        this._createCleanupTask(cleanupFunction);
+
+        this._createTask({
+          name,
+          cookieBehavior: BEHAVIOR_REJECT_TRACKER,
           blockingByContentBlocking: true,
           blockingByContentBlockingUI: false,
           blockingByContentBlockingRTUI: true,
           allowList: false,
           callback: callbackNonTracking,
           extraPrefs: [],
           expectedBlockingNotifications: false,
           runInPrivateWindow,
         });
         this._createCleanupTask(cleanupFunction);
 
         this._createTask({
           name,
           cookieBehavior: BEHAVIOR_REJECT_TRACKER,
           blockingByContentBlocking: true,
-          blockingByContentBlockingUI: true,
+          blockingByContentBlockingUI: false,
+          blockingByContentBlockingRTUI: false,
+          allowList: true,
+          callback: callbackNonTracking,
+          extraPrefs: [],
+          expectedBlockingNotifications: false,
+          runInPrivateWindow,
+        });
+        this._createCleanupTask(cleanupFunction);
+
+        this._createTask({
+          name,
+          cookieBehavior: BEHAVIOR_REJECT_TRACKER,
+          blockingByContentBlocking: true,
+          blockingByContentBlockingUI: false,
           blockingByContentBlockingRTUI: false,
           allowList: false,
           callback: callbackNonTracking,
           extraPrefs: [],
           expectedBlockingNotifications: false,
           runInPrivateWindow,
         });
         this._createCleanupTask(cleanupFunction);
@@ -212,30 +338,16 @@ this.AntiTracking = {
           extraPrefs: [],
           expectedBlockingNotifications: false,
           runInPrivateWindow,
         });
         this._createCleanupTask(cleanupFunction);
 
         this._createTask({
           name,
-          cookieBehavior: BEHAVIOR_REJECT_FOREIGN,
-          blockingByContentBlocking: true,
-          blockingByContentBlockingUI: true,
-          blockingByContentBlockingRTUI: false,
-          allowList: true,
-          callback: callbackNonTracking,
-          extraPrefs: [],
-          expectedBlockingNotifications: false,
-          runInPrivateWindow,
-        });
-        this._createCleanupTask(cleanupFunction);
-
-        this._createTask({
-          name,
           cookieBehavior: BEHAVIOR_REJECT_TRACKER,
           blockingByContentBlocking: false,
           blockingByContentBlockingUI: true,
           blockingByContentBlockingRTUI: true,
           allowList: true,
           callback: callbackNonTracking,
           extraPrefs: [],
           expectedBlockingNotifications: false,
@@ -254,34 +366,48 @@ this.AntiTracking = {
           extraPrefs: [],
           expectedBlockingNotifications: false,
           runInPrivateWindow,
         });
         this._createCleanupTask(cleanupFunction);
 
         this._createTask({
           name,
-          cookieBehavior: BEHAVIOR_REJECT_TRACKER,
-          blockingByContentBlocking: true,
+          cookieBehavior: BEHAVIOR_ACCEPT,
+          blockingByContentBlocking: false,
+          blockingByContentBlockingUI: true,
+          blockingByContentBlockingRTUI: true,
+          allowList: false,
+          callback: callbackNonTracking,
+          extraPrefs: [],
+          expectedBlockingNotifications: false,
+          runInPrivateWindow,
+        });
+        this._createCleanupTask(cleanupFunction);
+
+        this._createTask({
+          name,
+          cookieBehavior: BEHAVIOR_ACCEPT,
+          blockingByContentBlocking: false,
           blockingByContentBlockingUI: true,
           blockingByContentBlockingRTUI: false,
           allowList: true,
           callback: callbackNonTracking,
           extraPrefs: [],
           expectedBlockingNotifications: false,
           runInPrivateWindow,
         });
         this._createCleanupTask(cleanupFunction);
 
         this._createTask({
           name,
           cookieBehavior: BEHAVIOR_ACCEPT,
           blockingByContentBlocking: false,
           blockingByContentBlockingUI: true,
-          blockingByContentBlockingRTUI: true,
+          blockingByContentBlockingRTUI: false,
           allowList: false,
           callback: callbackNonTracking,
           extraPrefs: [],
           expectedBlockingNotifications: false,
           runInPrivateWindow,
         });
         this._createCleanupTask(cleanupFunction);
 
@@ -298,17 +424,31 @@ this.AntiTracking = {
           runInPrivateWindow,
         });
         this._createCleanupTask(cleanupFunction);
 
         this._createTask({
           name,
           cookieBehavior: BEHAVIOR_ACCEPT,
           blockingByContentBlocking: true,
-          blockingByContentBlockingUI: true,
+          blockingByContentBlockingUI: false,
+          blockingByContentBlockingRTUI: false,
+          allowList: true,
+          callback: callbackNonTracking,
+          extraPrefs: [],
+          expectedBlockingNotifications: false,
+          runInPrivateWindow,
+        });
+        this._createCleanupTask(cleanupFunction);
+
+        this._createTask({
+          name,
+          cookieBehavior: BEHAVIOR_ACCEPT,
+          blockingByContentBlocking: true,
+          blockingByContentBlockingUI: false,
           blockingByContentBlockingRTUI: false,
           allowList: false,
           callback: callbackNonTracking,
           extraPrefs: [],
           expectedBlockingNotifications: false,
           runInPrivateWindow,
         });
         this._createCleanupTask(cleanupFunction);
@@ -336,17 +476,19 @@ this.AntiTracking = {
           blockingByContentBlockingRTUI: true,
           allowList: true,
           callback: callbackNonTracking,
           extraPrefs: [],
           expectedBlockingNotifications: false,
           runInPrivateWindow,
         });
         this._createCleanupTask(cleanupFunction);
-      } else {
+      } else if (!options.blockingByContentBlocking ||
+                 !options.blockingByContentBlockingUI) {
+        // Don't run this extra test if we are in blocking mode!
         this._createTask({
           name,
           cookieBehavior: options.cookieBehavior,
           blockingByContentBlocking: options.blockingByContentBlocking,
           blockingByContentBlockingUI: options.blockingByContentBlockingUI,
           blockingByContentBlockingRTUI: options.blockingByContentBlockingRTUI,
           allowList: options.blockingByAllowList,
           callback: callbackNonTracking,
--- a/toolkit/components/antitracking/test/browser/imageCacheWorker.js
+++ b/toolkit/components/antitracking/test/browser/imageCacheWorker.js
@@ -1,13 +1,13 @@
 /* import-globals-from head.js */
 /* import-globals-from browser_imageCache1.js */
 ChromeUtils.import("resource://gre/modules/Services.jsm");
 
-AntiTracking.runTest("Image cache - should load the image twice.",
+AntiTracking.runTest("Image cache - should load the image three times.",
   // blocking callback
   async _ => {
     // Let's load the image twice here.
     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; });
     ok(true, "Image 1 loaded");
@@ -44,20 +44,24 @@ AntiTracking.runTest("Image cache - shou
   },
   null, // cleanup function
   null, // no extra prefs
   false, // no window open test
   false, // no user-interaction test
   expectedBlockingNotifications
 );
 
-// We still want to see just 2 requests.
+// If we didn't run the non-blocking test, only expect to have seen two images.
+// Otherwise, expect to have seen three images.
+let expected = (blockingByContentBlocking && blockingByContentBlockingUI) ? 2 : 3;
+
+// We still want to see just expected requests.
 add_task(async _ => {
   await fetch("https://tracking.example.org/browser/toolkit/components/antitracking/test/browser/image.sjs?result")
     .then(r => r.text())
     .then(text => {
-      is(text, 2, "The image should be loaded correctly.");
+      is(text, expected, "The image should be loaded correctly.");
     });
 
   await new Promise(resolve => {
     Services.clearData.deleteData(Ci.nsIClearDataService.CLEAR_ALL, value => resolve());
   });
 });