Bug 1794508 - Add tests r=asuth,anti-tracking-reviewers,pbz

Differential Revision: https://phabricator.services.mozilla.com/D161069
This commit is contained in:
Kagami Sascha Rosylight 2023-06-16 11:17:40 +00:00
parent ea54808066
commit 752e9eb70d

View File

@ -623,3 +623,73 @@ PartitionedStorageHelper.runTest(
["privacy.partition.serviceWorkers", true],
]
);
PartitionedStorageHelper.runTest(
"ServiceWorkers - Private Browsing with partitioning disabled",
async (win3rdParty, win1stParty, allowed) => {
// Partitioned serviceWorkers are disabled in third-party context.
ok(
!win3rdParty.navigator.serviceWorker,
"ServiceWorker should not be available"
);
ok(
!win1stParty.navigator.serviceWorker,
"ServiceWorker should not be available"
);
},
async _ => {
await new Promise(resolve => {
Services.clearData.deleteData(Ci.nsIClearDataService.CLEAR_ALL, value =>
resolve()
);
});
},
[
["dom.serviceWorkers.exemptFromPerDomainMax", true],
["dom.ipc.processCount", 1],
["dom.serviceWorkers.enabled", true],
["dom.serviceWorkers.testing.enabled", true],
["privacy.partition.serviceWorkers", false],
],
{
runInPrivateWindow: true,
}
);
PartitionedStorageHelper.runTest(
"ServiceWorkers - Private Browsing with partitioning enabled",
async (win3rdParty, win1stParty, allowed) => {
// Partitioned serviceWorkers are disabled in third-party context.
ok(
!win3rdParty.navigator.serviceWorker,
"ServiceWorker should not be available"
);
ok(
!win1stParty.navigator.serviceWorker,
"ServiceWorker should not be available"
);
},
async _ => {
await new Promise(resolve => {
Services.clearData.deleteData(Ci.nsIClearDataService.CLEAR_ALL, value =>
resolve()
);
});
},
[
["dom.serviceWorkers.exemptFromPerDomainMax", true],
["dom.ipc.processCount", 1],
["dom.serviceWorkers.enabled", true],
["dom.serviceWorkers.testing.enabled", true],
["privacy.partition.serviceWorkers", true],
],
{
runInPrivateWindow: true,
}
);