forked from mozilla/gecko-dev
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug 1839919 - Add tests for persistence and OA separation. r=bvanders…
…loot,anti-tracking-reviewers Differential Revision: https://phabricator.services.mozilla.com/D200821
- Loading branch information
Showing
5 changed files
with
322 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
73 changes: 73 additions & 0 deletions
73
...antitracking/bouncetrackingprotection/test/browser/browser_bouncetracking_oa_isolation.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
/* Any copyright is dedicated to the Public Domain. | ||
http://creativecommons.org/publicdomain/zero/1.0/ */ | ||
|
||
"use strict"; | ||
|
||
add_setup(async function () { | ||
await SpecialPowers.pushPrefEnv({ | ||
set: [ | ||
["privacy.bounceTrackingProtection.requireStatefulBounces", true], | ||
["privacy.bounceTrackingProtection.bounceTrackingGracePeriodSec", 0], | ||
], | ||
}); | ||
}); | ||
|
||
// Tests that bounces in PBM don't affect state in normal browsing. | ||
add_task(async function test_pbm_data_isolated() { | ||
await runTestBounce({ | ||
bounceType: "client", | ||
setState: "cookie-client", | ||
originAttributes: { privateBrowsingId: 1 }, | ||
postBounceCallback: () => { | ||
// After the PBM bounce assert that we haven't recorded any data for normal browsing. | ||
Assert.equal( | ||
bounceTrackingProtection.testGetBounceTrackerCandidateHosts({}).length, | ||
0, | ||
"No bounce tracker candidates for normal browsing." | ||
); | ||
Assert.equal( | ||
bounceTrackingProtection.testGetUserActivationHosts({}).length, | ||
0, | ||
"No user activations for normal browsing." | ||
); | ||
}, | ||
}); | ||
}); | ||
|
||
// Tests that bounces in PBM don't affect state in normal browsing. | ||
add_task(async function test_containers_isolated() { | ||
await runTestBounce({ | ||
bounceType: "server", | ||
setState: "cookie-server", | ||
originAttributes: { userContextId: 2 }, | ||
postBounceCallback: () => { | ||
// After the bounce in the container tab assert that we haven't recorded any data for normal browsing. | ||
Assert.equal( | ||
bounceTrackingProtection.testGetBounceTrackerCandidateHosts({}).length, | ||
0, | ||
"No bounce tracker candidates for normal browsing." | ||
); | ||
Assert.equal( | ||
bounceTrackingProtection.testGetUserActivationHosts({}).length, | ||
0, | ||
"No user activations for normal browsing." | ||
); | ||
|
||
// Or in another container tab. | ||
Assert.equal( | ||
bounceTrackingProtection.testGetBounceTrackerCandidateHosts({ | ||
userContextId: 1, | ||
}).length, | ||
0, | ||
"No bounce tracker candidates for container tab 1." | ||
); | ||
Assert.equal( | ||
bounceTrackingProtection.testGetUserActivationHosts({ | ||
userContextId: 1, | ||
}).length, | ||
0, | ||
"No user activations for container tab 1." | ||
); | ||
}, | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
toolkit/components/antitracking/bouncetrackingprotection/test/marionette/manifest.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
[DEFAULT] | ||
prefs = [ | ||
"privacy.bounceTrackingProtection.enabled=true", | ||
"privacy.bounceTrackingProtection.enableTestMode=true", | ||
] | ||
|
||
["test_bouncetracking_storage_persistence.py"] |
Oops, something went wrong.