Bug 1943536 - Part 6: Enable SA heuristics for trackers in certaian tests. r=bvandersloot

Depends on D238944

Differential Revision: https://phabricator.services.mozilla.com/D240015
This commit is contained in:
Tim Huang
2025-03-04 13:16:10 +00:00
parent 5c0eb2a805
commit 105f1a566b
10 changed files with 69 additions and 1 deletions

View File

@@ -369,6 +369,10 @@ add_task(async function testCookiesSubViewAllowedHeuristic() {
TPC_PREF, TPC_PREF,
Ci.nsICookieService.BEHAVIOR_REJECT_TRACKER Ci.nsICookieService.BEHAVIOR_REJECT_TRACKER
); );
Services.prefs.setBoolPref(
"privacy.restrict3rdpartystorage.heuristic.exclude_third_party_trackers",
false
);
let principal = let principal =
Services.scriptSecurityManager.createContentPrincipalFromOrigin( Services.scriptSecurityManager.createContentPrincipalFromOrigin(
// eslint-disable-next-line @microsoft/sdl/no-insecure-url // eslint-disable-next-line @microsoft/sdl/no-insecure-url
@@ -474,6 +478,9 @@ add_task(async function testCookiesSubViewAllowedHeuristic() {
BrowserTestUtils.removeTab(tab); BrowserTestUtils.removeTab(tab);
Services.prefs.clearUserPref(TPC_PREF); Services.prefs.clearUserPref(TPC_PREF);
Services.prefs.clearUserPref(
"privacy.restrict3rdpartystorage.heuristic.exclude_third_party_trackers"
);
}); });
add_task(async function testCookiesSubViewBlockedDoublyNested() { add_task(async function testCookiesSubViewBlockedDoublyNested() {

View File

@@ -988,6 +988,15 @@ this.AntiTracking = {
await TestUtils.topicObserved("browser-delayed-startup-finished"); await TestUtils.topicObserved("browser-delayed-startup-finished");
} }
// Enable SA heuristics for trackers because the test depends on it.
extraPrefs = [
...(extraPrefs || []),
[
"privacy.restrict3rdpartystorage.heuristic.exclude_third_party_trackers",
false,
],
];
await AntiTracking._setupTest( await AntiTracking._setupTest(
win, win,
cookieBehavior, cookieBehavior,
@@ -1114,6 +1123,15 @@ this.AntiTracking = {
await TestUtils.topicObserved("browser-delayed-startup-finished"); await TestUtils.topicObserved("browser-delayed-startup-finished");
} }
// Enable SA heuristics for trackers because the test depends on it.
extraPrefs = [
...(extraPrefs || []),
[
"privacy.restrict3rdpartystorage.heuristic.exclude_third_party_trackers",
false,
],
];
await AntiTracking._setupTest( await AntiTracking._setupTest(
win, win,
cookieBehavior, cookieBehavior,

View File

@@ -143,6 +143,11 @@ add_setup(async function () {
// telemetry too soon. // telemetry too soon.
["privacy.restrict3rdpartystorage.expiration", 2591999], ["privacy.restrict3rdpartystorage.expiration", 2591999],
["privacy.restrict3rdpartystorage.expiration_redirect", 2591999], ["privacy.restrict3rdpartystorage.expiration_redirect", 2591999],
// Enable SA heuristics for trackers because the test depends on it.
[
"privacy.restrict3rdpartystorage.heuristic.exclude_third_party_trackers",
false,
],
], ],
}); });

View File

@@ -16,6 +16,11 @@ add_task(async function () {
["privacy.trackingprotection.enabled", false], ["privacy.trackingprotection.enabled", false],
["privacy.trackingprotection.pbmode.enabled", false], ["privacy.trackingprotection.pbmode.enabled", false],
["privacy.trackingprotection.annotate_channels", true], ["privacy.trackingprotection.annotate_channels", true],
// Enable SA heuristics for trackers because the test depends on it.
[
"privacy.restrict3rdpartystorage.heuristic.exclude_third_party_trackers",
false,
],
], ],
}); });

View File

@@ -313,6 +313,11 @@ add_task(async function testPermissionGrantedOnFirstParty() {
["privacy.trackingprotection.enabled", false], ["privacy.trackingprotection.enabled", false],
["privacy.trackingprotection.pbmode.enabled", false], ["privacy.trackingprotection.pbmode.enabled", false],
["privacy.trackingprotection.annotate_channels", true], ["privacy.trackingprotection.annotate_channels", true],
// Enable SA heuristics for trackers because the test depends on it.
[
"privacy.restrict3rdpartystorage.heuristic.exclude_third_party_trackers",
false,
],
], ],
}); });

View File

@@ -19,6 +19,11 @@ add_task(async function () {
"privacy.restrict3rdpartystorage.userInteractionRequiredForHosts", "privacy.restrict3rdpartystorage.userInteractionRequiredForHosts",
"tracking.example.com,tracking.example.org", "tracking.example.com,tracking.example.org",
], ],
// Enable SA heuristics for trackers because the test depends on it.
[
"privacy.restrict3rdpartystorage.heuristic.exclude_third_party_trackers",
false,
],
], ],
}); });

View File

@@ -221,7 +221,13 @@ AntiTracking.runTest(
); );
}); });
}, },
[["dom.storage_access.enabled", true]], // extra prefs [
["dom.storage_access.enabled", true],
[
"privacy.restrict3rdpartystorage.heuristic.exclude_third_party_trackers",
false,
],
], // extra prefs
false, // no window open test false, // no window open test
false, // no user-interaction test false, // no user-interaction test
Ci.nsIWebProgressListener.STATE_COOKIES_BLOCKED_TRACKER, // expected blocking notifications Ci.nsIWebProgressListener.STATE_COOKIES_BLOCKED_TRACKER, // expected blocking notifications

View File

@@ -47,6 +47,13 @@ AntiTracking._createTask({
"https://tracking.example.org", "https://tracking.example.org",
"https://tracking.example.org", "https://tracking.example.org",
], ],
extraPrefs: [
// Enable SA heuristics for trackers because the test depends on it.
[
"privacy.restrict3rdpartystorage.heuristic.exclude_third_party_trackers",
false,
],
],
}); });
add_task(async _ => { add_task(async _ => {

View File

@@ -38,6 +38,11 @@ add_setup(async function () {
"privacy.restrict3rdpartystorage.userInteractionRequiredForHosts", "privacy.restrict3rdpartystorage.userInteractionRequiredForHosts",
"tracking.example.com,tracking.example.org", "tracking.example.com,tracking.example.org",
], ],
// Enable SA heuristics for trackers because the test depends on it.
[
"privacy.restrict3rdpartystorage.heuristic.exclude_third_party_trackers",
false,
],
], ],
}); });

View File

@@ -22,6 +22,11 @@ add_task(async function () {
], ],
// Bug 1617611: Fix all the tests broken by "cookies SameSite=lax by default" // Bug 1617611: Fix all the tests broken by "cookies SameSite=lax by default"
["network.cookie.sameSite.laxByDefault", false], ["network.cookie.sameSite.laxByDefault", false],
// Enable SA heuristics for trackers because the test depends on it.
[
"privacy.restrict3rdpartystorage.heuristic.exclude_third_party_trackers",
false,
],
], ],
}); });