summaryrefslogtreecommitdiffstats
path: root/toolkit/components/antitracking/bouncetrackingprotection/test/browser/browser_bouncetracking_purge.js
diff options
context:
space:
mode:
Diffstat (limited to 'toolkit/components/antitracking/bouncetrackingprotection/test/browser/browser_bouncetracking_purge.js')
-rw-r--r--toolkit/components/antitracking/bouncetrackingprotection/test/browser/browser_bouncetracking_purge.js66
1 files changed, 66 insertions, 0 deletions
diff --git a/toolkit/components/antitracking/bouncetrackingprotection/test/browser/browser_bouncetracking_purge.js b/toolkit/components/antitracking/bouncetrackingprotection/test/browser/browser_bouncetracking_purge.js
index a8e98b80f0..eedd374197 100644
--- a/toolkit/components/antitracking/bouncetrackingprotection/test/browser/browser_bouncetracking_purge.js
+++ b/toolkit/components/antitracking/bouncetrackingprotection/test/browser/browser_bouncetracking_purge.js
@@ -119,3 +119,69 @@ add_task(async function test_purging_skip_open_tab_extra_window() {
bounceTrackingProtection.clearAll();
});
+
+add_task(async function test_purging_skip_content_blocking_allow_list() {
+ initBounceTrackerState();
+
+ await BrowserTestUtils.withNewTab("https://example.com", async browser => {
+ window.ContentBlockingAllowList.add(browser);
+ });
+
+ Assert.deepEqual(
+ await bounceTrackingProtection.testRunPurgeBounceTrackers(),
+ ["example.net"],
+ "Should only purge example.net. example.org is within the grace period, example.com is allow-listed."
+ );
+
+ info(
+ "Remove the allow-list entry for example.com and test that it gets purged now."
+ );
+
+ await BrowserTestUtils.withNewTab("https://example.com", async browser => {
+ window.ContentBlockingAllowList.remove(browser);
+ });
+ Assert.deepEqual(
+ await bounceTrackingProtection.testRunPurgeBounceTrackers(),
+ ["example.com"],
+ "example.com should have been purged now that it is no longer allow-listed."
+ );
+
+ bounceTrackingProtection.clearAll();
+});
+
+add_task(
+ async function test_purging_skip_content_blocking_allow_list_subdomain() {
+ initBounceTrackerState();
+
+ await BrowserTestUtils.withNewTab(
+ "https://test1.example.com",
+ async browser => {
+ window.ContentBlockingAllowList.add(browser);
+ }
+ );
+
+ Assert.deepEqual(
+ await bounceTrackingProtection.testRunPurgeBounceTrackers(),
+ ["example.net"],
+ "Should only purge example.net. example.org is within the grace period, example.com is allow-listed via test1.example.com."
+ );
+
+ info(
+ "Remove the allow-list entry for test1.example.com and test that it gets purged now."
+ );
+
+ await BrowserTestUtils.withNewTab(
+ "https://test1.example.com",
+ async browser => {
+ window.ContentBlockingAllowList.remove(browser);
+ }
+ );
+ Assert.deepEqual(
+ await bounceTrackingProtection.testRunPurgeBounceTrackers(),
+ ["example.com"],
+ "example.com should have been purged now that test1.example.com it is no longer allow-listed."
+ );
+
+ bounceTrackingProtection.clearAll();
+ }
+);