Bug 1753229 - Remove the special treatment for dFPI in the test test_service_worker.html r=ckerschb,anti-tracking-reviewers,bvandersloot

Given that we have enabled the service worker partitioning in Nightly
when dFPI is enabled, the test result should be the same as dFPI is
disabled. So, in this patch, we remove the special treatment for dFPI in
the test. Otherwise, the test will fail when we enable dFPI in mochitests.

Differential Revision: https://phabricator.services.mozilla.com/D137734
This commit is contained in:
Tim Huang 2022-02-09 14:42:39 +00:00
Родитель 8037c3adc5
Коммит 020bd4ee20
2 изменённых файлов: 5 добавлений и 22 удалений

Просмотреть файл

@ -9,27 +9,13 @@
window.parent.postMessage({result: status}, "*");
}
const BEHAVIOR_REJECT_TRACKER_AND_PARTITION_FOREIGN = 5;
const cookieBehavior = SpecialPowers.getIntPref("network.cookie.cookieBehavior");
const promises = [
navigator.serviceWorker.ready,
navigator.serviceWorker.register("file_service_worker.js", { scope: "." })
];
if (cookieBehavior == BEHAVIOR_REJECT_TRACKER_AND_PARTITION_FOREIGN) {
Promise.allSettled(promises).then(results => {
const resultValues = results
.map(result =>
result.status === "fulfilled" ? "allowed" : "blocked"
)
.join(",");
finish(resultValues);
});
} else {
Promise.race(promises).then(finish.bind(null, 'allowed'),
finish.bind(null, 'blocked'));
}
Promise.race(promises).then(finish.bind(null, 'allowed'),
finish.bind(null, 'blocked'));
</script>
</body>
</html>

Просмотреть файл

@ -17,14 +17,10 @@
*/
SimpleTest.waitForExplicitFinish();
const BEHAVIOR_REJECT_TRACKER_AND_PARTITION_FOREIGN = 5;
var cookieBehavior = SpecialPowers.getIntPref("network.cookie.cookieBehavior");
var tests = [
{
policy: "default-src 'self'; script-src 'unsafe-inline'; child-src test1.example.com;",
expected: cookieBehavior == BEHAVIOR_REJECT_TRACKER_AND_PARTITION_FOREIGN
? "blocked,blocked"
: "blocked"
expected: "blocked"
},
];
@ -42,7 +38,8 @@ onload = function() {
["dom.serviceWorkers.exemptFromPerDomainMax", true],
["dom.serviceWorkers.enabled", true],
["dom.serviceWorkers.testing.enabled", true],
["dom.caches.enabled", true]
["dom.caches.enabled", true],
["privacy.partition.serviceWorkers", true],
]}, loadNextTest);
}