diff options
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.js | 45 |
1 files changed, 42 insertions, 3 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 eedd374197..676ac5fe92 100644 --- a/toolkit/components/antitracking/bouncetrackingprotection/test/browser/browser_bouncetracking_purge.js +++ b/toolkit/components/antitracking/bouncetrackingprotection/test/browser/browser_bouncetracking_purge.js @@ -133,8 +133,21 @@ add_task(async function test_purging_skip_content_blocking_allow_list() { "Should only purge example.net. example.org is within the grace period, example.com is allow-listed." ); + // example.net is removed because it is purged, example.com is removed because + // it is allow-listed. + Assert.deepEqual( + bounceTrackingProtection + .testGetBounceTrackerCandidateHosts({}) + .map(entry => entry.siteHost), + ["example.org"], + "Should have removed example.net and example.com from bounce tracker candidate list." + ); + + info("Add example.com as a bounce tracker candidate again."); + bounceTrackingProtection.testAddBounceTrackerCandidate({}, "example.com", 1); + info( - "Remove the allow-list entry for example.com and test that it gets purged now." + "Remove the allow-list entry for example.com and test that it gets purged now." ); await BrowserTestUtils.withNewTab("https://example.com", async browser => { @@ -146,6 +159,16 @@ add_task(async function test_purging_skip_content_blocking_allow_list() { "example.com should have been purged now that it is no longer allow-listed." ); + // example.org is still in the grace period so it neither gets purged nor + // removed from the candidate list. + Assert.deepEqual( + bounceTrackingProtection + .testGetBounceTrackerCandidateHosts({}) + .map(entry => entry.siteHost), + ["example.org"], + "Should have removed example.com from bounce tracker candidate list." + ); + bounceTrackingProtection.clearAll(); }); @@ -166,8 +189,24 @@ add_task( "Should only purge example.net. example.org is within the grace period, example.com is allow-listed via test1.example.com." ); + // example.net is removed because it is purged, example.com is removed because it is allow-listed. + Assert.deepEqual( + bounceTrackingProtection + .testGetBounceTrackerCandidateHosts({}) + .map(entry => entry.siteHost), + ["example.org"], + "Should have removed example.net and example.com from bounce tracker candidate list." + ); + + info("Add example.com as a bounce tracker candidate again."); + bounceTrackingProtection.testAddBounceTrackerCandidate( + {}, + "example.com", + 1 + ); + info( - "Remove the allow-list entry for test1.example.com and test that it gets purged now." + "Remove the allow-list entry for test1.example.com and test that it gets purged now." ); await BrowserTestUtils.withNewTab( @@ -179,7 +218,7 @@ add_task( Assert.deepEqual( await bounceTrackingProtection.testRunPurgeBounceTrackers(), ["example.com"], - "example.com should have been purged now that test1.example.com it is no longer allow-listed." + "example.com should have been purged now that test1.example.com is no longer allow-listed." ); bounceTrackingProtection.clearAll(); |