Bug 1491061 - Part 2: Add tests to ensure that third-party cookie blocking restrictions under content blocking also follow UI prefs r=baku
☠☠ backed out by 79125b42f1be ☠ ☠
authorEhsan Akhgari <ehsan@mozilla.com>
Thu, 20 Sep 2018 15:45:52 +0000
changeset 492708 cda57041cc59e00cb1abb612fdbc2da48ad82826
parent 492707 725bd7c9fefd617fded177ed20f42239cb3802ee
child 492709 ae17f86c72f9c2eefd08a5d90e5641dd36bd557e
push id1815
push userffxbld-merge
push dateMon, 15 Oct 2018 10:40:45 +0000
treeherdermozilla-release@18d4c09e9378 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbaku
bugs1491061
milestone63.0
Bug 1491061 - Part 2: Add tests to ensure that third-party cookie blocking restrictions under content blocking also follow UI prefs r=baku Depends on D5887 Differential Revision: https://phabricator.services.mozilla.com/D5888
toolkit/components/antitracking/test/browser/browser.ini
toolkit/components/antitracking/test/browser/browser_backgroundImageAssertion.js
toolkit/components/antitracking/test/browser/browser_existingCookiesForSubresources.js
toolkit/components/antitracking/test/browser/browser_imageCache1.js
toolkit/components/antitracking/test/browser/browser_imageCache10.js
toolkit/components/antitracking/test/browser/browser_imageCache11.js
toolkit/components/antitracking/test/browser/browser_imageCache12.js
toolkit/components/antitracking/test/browser/browser_imageCache13.js
toolkit/components/antitracking/test/browser/browser_imageCache14.js
toolkit/components/antitracking/test/browser/browser_imageCache15.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/browser_imageCache8.js
toolkit/components/antitracking/test/browser/browser_imageCache9.js
toolkit/components/antitracking/test/browser/browser_onBeforeRequestNotificationForTrackingResources.js
toolkit/components/antitracking/test/browser/browser_onModifyRequestNotificationForTrackingResources.js
toolkit/components/antitracking/test/browser/browser_script.js
toolkit/components/antitracking/test/browser/browser_subResources.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
@@ -24,16 +24,24 @@ support-files = server.sjs
 [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_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_onModifyRequestNotificationForTrackingResources.js]
 [browser_permissionInNormalWindows.js]
 [browser_permissionInPrivateWindows.js]
 [browser_subResources.js]
 support-files = subResources.sjs
 [browser_script.js]
 support-files = tracker.js
--- a/toolkit/components/antitracking/test/browser/browser_backgroundImageAssertion.js
+++ b/toolkit/components/antitracking/test/browser/browser_backgroundImageAssertion.js
@@ -1,16 +1,18 @@
 ChromeUtils.import("resource://gre/modules/Services.jsm");
 
 add_task(async function() {
   info("Starting subResources test");
 
   await SpecialPowers.flushPrefEnv();
   await SpecialPowers.pushPrefEnv({"set": [
     ["browser.contentblocking.enabled", true],
+    ["browser.contentblocking.ui.enabled", true],
+    ["browser.contentblocking.ui.rejecttrackers.enabled", true],
     ["network.cookie.cookieBehavior", Ci.nsICookieService.BEHAVIOR_REJECT_TRACKER],
     ["privacy.trackingprotection.enabled", false],
     ["privacy.trackingprotection.pbmode.enabled", false],
     ["privacy.trackingprotection.annotate_channels", true],
   ]});
 
   await UrlClassifierTestUtils.addTestTrackers();
 
--- a/toolkit/components/antitracking/test/browser/browser_existingCookiesForSubresources.js
+++ b/toolkit/components/antitracking/test/browser/browser_existingCookiesForSubresources.js
@@ -69,16 +69,18 @@ add_task(async function() {
   info("Removing the tab");
   BrowserTestUtils.removeTab(tab);
 
   Services.perms.removeAll();
 
   // Now set up our prefs
   await SpecialPowers.pushPrefEnv({"set": [
     ["browser.contentblocking.enabled", true],
+    ["browser.contentblocking.ui.enabled", true],
+    ["browser.contentblocking.rejecttrackers.ui.enabled", true],
     ["network.cookie.cookieBehavior", Ci.nsICookieService.BEHAVIOR_REJECT_TRACKER],
   ]});
 
   info("Creating a new tab");
   tab = BrowserTestUtils.addTab(gBrowser, TEST_TOP_PAGE);
   gBrowser.selectedTab = tab;
 
   browser = gBrowser.getBrowserForTab(tab);
--- a/toolkit/components/antitracking/test/browser/browser_imageCache1.js
+++ b/toolkit/components/antitracking/test/browser/browser_imageCache1.js
@@ -1,13 +1,16 @@
 ChromeUtils.import("resource://gre/modules/Services.jsm");
 
 let cookieBehavior = BEHAVIOR_REJECT_TRACKER;
 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 */
new file mode 100644
--- /dev/null
+++ b/toolkit/components/antitracking/test/browser/browser_imageCache10.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 = 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);
+
new file mode 100644
--- /dev/null
+++ b/toolkit/components/antitracking/test/browser/browser_imageCache11.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 = 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);
+
new file mode 100644
--- /dev/null
+++ b/toolkit/components/antitracking/test/browser/browser_imageCache12.js
@@ -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);
+
new file mode 100644
--- /dev/null
+++ b/toolkit/components/antitracking/test/browser/browser_imageCache13.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 = 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);
new file mode 100644
--- /dev/null
+++ b/toolkit/components/antitracking/test/browser/browser_imageCache14.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 = 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);
new file mode 100644
--- /dev/null
+++ b/toolkit/components/antitracking/test/browser/browser_imageCache15.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 = 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);
--- a/toolkit/components/antitracking/test/browser/browser_imageCache2.js
+++ b/toolkit/components/antitracking/test/browser/browser_imageCache2.js
@@ -1,13 +1,16 @@
 ChromeUtils.import("resource://gre/modules/Services.jsm");
 
 let cookieBehavior = BEHAVIOR_REJECT_TRACKER;
 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 */
--- a/toolkit/components/antitracking/test/browser/browser_imageCache3.js
+++ b/toolkit/components/antitracking/test/browser/browser_imageCache3.js
@@ -1,13 +1,16 @@
 ChromeUtils.import("resource://gre/modules/Services.jsm");
 
 let cookieBehavior = BEHAVIOR_REJECT_TRACKER;
 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 */
--- a/toolkit/components/antitracking/test/browser/browser_imageCache4.js
+++ b/toolkit/components/antitracking/test/browser/browser_imageCache4.js
@@ -1,13 +1,16 @@
 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 */
--- a/toolkit/components/antitracking/test/browser/browser_imageCache5.js
+++ b/toolkit/components/antitracking/test/browser/browser_imageCache5.js
@@ -1,13 +1,16 @@
 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 */
--- a/toolkit/components/antitracking/test/browser/browser_imageCache6.js
+++ b/toolkit/components/antitracking/test/browser/browser_imageCache6.js
@@ -1,13 +1,16 @@
 ChromeUtils.import("resource://gre/modules/Services.jsm");
 
 let cookieBehavior = BEHAVIOR_REJECT_FOREIGN;
 let blockingByContentBlocking = false;
+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 */
new file mode 100644
--- /dev/null
+++ b/toolkit/components/antitracking/test/browser/browser_imageCache8.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 = 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);
+
new file mode 100644
--- /dev/null
+++ b/toolkit/components/antitracking/test/browser/browser_imageCache9.js
@@ -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);
+
--- a/toolkit/components/antitracking/test/browser/browser_onBeforeRequestNotificationForTrackingResources.js
+++ b/toolkit/components/antitracking/test/browser/browser_onBeforeRequestNotificationForTrackingResources.js
@@ -48,16 +48,18 @@ add_task(async function() {
 });
 
 add_task(async function() {
   info("Starting subResources test");
 
   await SpecialPowers.flushPrefEnv();
   await SpecialPowers.pushPrefEnv({"set": [
     ["browser.contentblocking.enabled", true],
+    ["browser.contentblocking.ui.enabled", true],
+    ["browser.contentblocking.rejecttrackers.ui.enabled", true],
     ["privacy.trackingprotection.enabled", true],
     // the test doesn't open a private window, so we don't care about this pref's value
     ["privacy.trackingprotection.pbmode.enabled", false],
     // tracking annotations aren't needed in this test, only TP is needed
     ["privacy.trackingprotection.annotate_channels", false],
     // prevent the content blocking on-boarding UI to start mid-way through the test!
     [ContentBlocking.prefIntroCount, ContentBlocking.MAX_INTROS],
   ]});
--- a/toolkit/components/antitracking/test/browser/browser_onModifyRequestNotificationForTrackingResources.js
+++ b/toolkit/components/antitracking/test/browser/browser_onModifyRequestNotificationForTrackingResources.js
@@ -43,16 +43,18 @@ async function onModifyRequest() {
 }
 
 add_task(async function() {
   info("Starting subResources test");
 
   await SpecialPowers.flushPrefEnv();
   await SpecialPowers.pushPrefEnv({"set": [
     ["browser.contentblocking.enabled", true],
+    ["browser.contentblocking.ui.enabled", true],
+    ["browser.contentblocking.rejecttrackers.ui.enabled", true],
     ["privacy.trackingprotection.enabled", true],
     // the test doesn't open a private window, so we don't care about this pref's value
     ["privacy.trackingprotection.pbmode.enabled", false],
     // tracking annotations aren't needed in this test, only TP is needed
     ["privacy.trackingprotection.annotate_channels", false],
     // prevent the content blocking on-boarding UI to start mid-way through the test!
     [ContentBlocking.prefIntroCount, ContentBlocking.MAX_INTROS],
   ]});
--- a/toolkit/components/antitracking/test/browser/browser_script.js
+++ b/toolkit/components/antitracking/test/browser/browser_script.js
@@ -1,16 +1,18 @@
 ChromeUtils.import("resource://gre/modules/Services.jsm");
 
 add_task(async function() {
   info("Starting subResources test");
 
   await SpecialPowers.flushPrefEnv();
   await SpecialPowers.pushPrefEnv({"set": [
     ["browser.contentblocking.enabled", true],
+    ["browser.contentblocking.ui.enabled", true],
+    ["browser.contentblocking.rejecttrackers.ui.enabled", true],
     ["network.cookie.cookieBehavior", Ci.nsICookieService.BEHAVIOR_REJECT_TRACKER],
     ["privacy.trackingprotection.enabled", false],
     ["privacy.trackingprotection.pbmode.enabled", false],
     ["privacy.trackingprotection.annotate_channels", true],
   ]});
 
   await UrlClassifierTestUtils.addTestTrackers();
 
--- a/toolkit/components/antitracking/test/browser/browser_subResources.js
+++ b/toolkit/components/antitracking/test/browser/browser_subResources.js
@@ -1,16 +1,18 @@
 ChromeUtils.import("resource://gre/modules/Services.jsm");
 
 add_task(async function() {
   info("Starting subResources test");
 
   await SpecialPowers.flushPrefEnv();
   await SpecialPowers.pushPrefEnv({"set": [
     ["browser.contentblocking.enabled", true],
+    ["browser.contentblocking.ui.enabled", true],
+    ["browser.contentblocking.rejecttrackers.ui.enabled", true],
     ["network.cookie.cookieBehavior", Ci.nsICookieService.BEHAVIOR_REJECT_TRACKER],
     ["privacy.trackingprotection.enabled", false],
     ["privacy.trackingprotection.pbmode.enabled", false],
     ["privacy.trackingprotection.annotate_channels", true],
   ]});
 
   await UrlClassifierTestUtils.addTestTrackers();
 
--- a/toolkit/components/antitracking/test/browser/head.js
+++ b/toolkit/components/antitracking/test/browser/head.js
@@ -15,25 +15,29 @@ const TEST_3RD_PARTY_PAGE_WITH_SVG = TES
 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", {});
 
+requestLongerTimeout(3);
+
 this.AntiTracking = {
   runTest(name, callbackTracking, callbackNonTracking, cleanupFunction, extraPrefs,
           windowOpenTest = true, userInteractionTest = true, expectedBlockingNotifications = true,
           runInPrivateWindow = false) {
     // Here we want to test that a 3rd party context is simply blocked.
     this._createTask({
       name,
       cookieBehavior: BEHAVIOR_REJECT_TRACKER,
       blockingByContentBlocking: true,
+      blockingByContentBlockingUI: true,
+      blockingByContentBlockingRTUI: true,
       allowList: false,
       callback: callbackTracking,
       extraPrefs,
       expectedBlockingNotifications,
       runInPrivateWindow,
     });
     this._createCleanupTask(cleanupFunction);
 
@@ -49,133 +53,305 @@ this.AntiTracking = {
           options.cookieBehavior = BEHAVIOR_ACCEPT;
         }
         if ("blockingByContentBlocking" in callbackNonTracking) {
           options.blockingByContentBlocking =
             callbackNonTracking.blockingByContentBlocking;
         } else {
           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) {
           options.blockingByAllowList =
             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 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.
         // All of these cases are tested here.
         this._createTask({
           name,
           cookieBehavior: BEHAVIOR_ACCEPT,
           blockingByContentBlocking: true,
+          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: true,
+          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,
+          blockingByContentBlockingRTUI: false,
           allowList: false,
           callback: callbackNonTracking,
           extraPrefs: [],
           expectedBlockingNotifications: false,
           runInPrivateWindow,
         });
         this._createCleanupTask(cleanupFunction);
 
         this._createTask({
           name,
           cookieBehavior: BEHAVIOR_REJECT_TRACKER,
           blockingByContentBlocking: false,
+          blockingByContentBlockingUI: true,
+          blockingByContentBlockingRTUI: true,
+          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,
+          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: true,
+          callback: callbackNonTracking,
+          extraPrefs: [],
+          expectedBlockingNotifications: false,
+          runInPrivateWindow,
+        });
+        this._createCleanupTask(cleanupFunction);
+
+        this._createTask({
+          name,
+          cookieBehavior: BEHAVIOR_REJECT_FOREIGN,
+          blockingByContentBlocking: true,
+          blockingByContentBlockingUI: false,
+          blockingByContentBlockingRTUI: true,
+          allowList: true,
+          callback: callbackNonTracking,
+          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,
+          runInPrivateWindow,
+        });
+        this._createCleanupTask(cleanupFunction);
+
+        this._createTask({
+          name,
+          cookieBehavior: BEHAVIOR_REJECT_TRACKER,
+          blockingByContentBlocking: true,
+          blockingByContentBlockingUI: false,
+          blockingByContentBlockingRTUI: true,
+          allowList: true,
+          callback: callbackNonTracking,
+          extraPrefs: [],
+          expectedBlockingNotifications: false,
+          runInPrivateWindow,
+        });
+        this._createCleanupTask(cleanupFunction);
+
+        this._createTask({
+          name,
+          cookieBehavior: BEHAVIOR_REJECT_TRACKER,
+          blockingByContentBlocking: true,
+          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,
+          allowList: false,
+          callback: callbackNonTracking,
+          extraPrefs: [],
+          expectedBlockingNotifications: false,
+          runInPrivateWindow,
+        });
+        this._createCleanupTask(cleanupFunction);
+
+        this._createTask({
+          name,
+          cookieBehavior: BEHAVIOR_ACCEPT,
+          blockingByContentBlocking: true,
+          blockingByContentBlockingUI: false,
+          blockingByContentBlockingRTUI: true,
+          allowList: false,
+          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);
 
         // Try testing using the allow list with both reject foreign and reject tracker cookie behaviors
         this._createTask({
           name,
           cookieBehavior: BEHAVIOR_REJECT_FOREIGN,
           blockingByContentBlocking: true,
+          blockingByContentBlockingUI: true,
+          blockingByContentBlockingRTUI: true,
           allowList: true,
           callback: callbackNonTracking,
           extraPrefs: [],
           expectedBlockingNotifications: false,
           runInPrivateWindow,
         });
         this._createCleanupTask(cleanupFunction);
 
         this._createTask({
           name,
           cookieBehavior: BEHAVIOR_REJECT_TRACKER,
           blockingByContentBlocking: true,
+          blockingByContentBlockingUI: true,
+          blockingByContentBlockingRTUI: true,
           allowList: true,
           callback: callbackNonTracking,
           extraPrefs: [],
           expectedBlockingNotifications: false,
           runInPrivateWindow,
         });
         this._createCleanupTask(cleanupFunction);
       } else {
         this._createTask({
           name,
           cookieBehavior: options.cookieBehavior,
           blockingByContentBlocking: options.blockingByContentBlocking,
+          blockingByContentBlockingUI: options.blockingByContentBlockingUI,
+          blockingByContentBlockingRTUI: options.blockingByContentBlockingRTUI,
           allowList: options.blockingByAllowList,
           callback: callbackNonTracking,
           extraPrefs: [],
           expectedBlockingNotifications: false,
           runInPrivateWindow,
         });
         this._createCleanupTask(cleanupFunction);
       }
@@ -191,20 +367,24 @@ this.AntiTracking = {
       // get blocked with user interaction present
       if (userInteractionTest) {
         this._createUserInteractionTask(name, callbackTracking, callbackNonTracking, runInPrivateWindow, extraPrefs);
         this._createCleanupTask(cleanupFunction);
       }
     }
   },
 
-  async _setupTest(win, cookieBehavior, blockingByContentBlocking, extraPrefs) {
+  async _setupTest(win, cookieBehavior, blockingByContentBlocking,
+                   blockingByContentBlockingUI, blockingByContentBlockingRTUI,
+                   extraPrefs) {
     await SpecialPowers.flushPrefEnv();
     await SpecialPowers.pushPrefEnv({"set": [
       ["browser.contentblocking.enabled", blockingByContentBlocking],
+      ["browser.contentblocking.ui.enabled", blockingByContentBlockingUI],
+      ["browser.contentblocking.rejecttrackers.ui.enabled", blockingByContentBlockingRTUI],
       ["network.cookie.cookieBehavior", cookieBehavior],
       ["privacy.trackingprotection.enabled", false],
       ["privacy.trackingprotection.pbmode.enabled", false],
       ["privacy.trackingprotection.annotate_channels", cookieBehavior != BEHAVIOR_ACCEPT],
       [win.ContentBlocking.prefIntroCount, win.ContentBlocking.MAX_INTROS],
     ]});
 
     if (extraPrefs && Array.isArray(extraPrefs) && extraPrefs.length) {
@@ -212,30 +392,34 @@ this.AntiTracking = {
     }
 
     await UrlClassifierTestUtils.addTestTrackers();
   },
 
   _createTask(options) {
     add_task(async function() {
       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 +
                          " running in a " + (options.runInPrivateWindow ? "private" : "normal") + " window");
 
       requestLongerTimeout(2);
 
       let win = window;
       if (options.runInPrivateWindow) {
         win = OpenBrowserWindow({private: true});
         await TestUtils.topicObserved("browser-delayed-startup-finished");
       }
 
       await AntiTracking._setupTest(win, options.cookieBehavior,
                                     options.blockingByContentBlocking,
+                                    options.blockingByContentBlockingUI,
+                                    options.blockingByContentBlockingRTUI,
                                     options.extraPrefs);
 
       let cookieBlocked = 0;
       let listener = {
         onSecurityChange(webProgress, request, stateFlags, status) {
           if (stateFlags & Ci.nsIWebProgressListener.STATE_COOKIES_BLOCKED_TRACKER) {
             ++cookieBlocked;
           }
@@ -332,17 +516,17 @@ this.AntiTracking = {
       requestLongerTimeout(2);
 
       let win = window;
       if (runInPrivateWindow) {
         win = OpenBrowserWindow({private: true});
         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");
       let tab = BrowserTestUtils.addTab(win.gBrowser, TEST_TOP_PAGE);
       win.gBrowser.selectedTab = tab;
 
       let browser = win.gBrowser.getBrowserForTab(tab);
       await BrowserTestUtils.browserLoaded(browser);
 
@@ -406,17 +590,17 @@ this.AntiTracking = {
       requestLongerTimeout(2);
 
       let win = window;
       if (runInPrivateWindow) {
         win = OpenBrowserWindow({private: true});
         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");
       let tab = BrowserTestUtils.addTab(win.gBrowser, TEST_TOP_PAGE);
       win.gBrowser.selectedTab = tab;
 
       let browser = win.gBrowser.getBrowserForTab(tab);
       await BrowserTestUtils.browserLoaded(browser);
 
--- a/toolkit/components/antitracking/test/browser/imageCacheWorker.js
+++ b/toolkit/components/antitracking/test/browser/imageCacheWorker.js
@@ -19,16 +19,18 @@ AntiTracking.runTest("Image cache - shou
     ok(true, "Image 2 loaded");
   },
 
   // non-blocking callback
   {
     runExtraTests: false,
     cookieBehavior,
     blockingByContentBlocking,
+    blockingByContentBlockingUI,
+    blockingByContentBlockingRTUI,
     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; });
       ok(true, "Image 3 loaded");
@@ -38,17 +40,18 @@ 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 4 loaded");
     },
   },
   null, // cleanup function
   null, // no extra prefs
   false, // no window open test
-  false // no user-interaction test
+  false, // no user-interaction test
+  expectedBlockingNotifications
 );
 
 // We still want to see just 2 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.");