diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
commit | 26a029d407be480d791972afb5975cf62c9360a6 (patch) | |
tree | f435a8308119effd964b339f76abb83a57c29483 /toolkit/components/antitracking/test/browser/browser_partitionedLockManager.js | |
parent | Initial commit. (diff) | |
download | firefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz firefox-26a029d407be480d791972afb5975cf62c9360a6.zip |
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'toolkit/components/antitracking/test/browser/browser_partitionedLockManager.js')
-rw-r--r-- | toolkit/components/antitracking/test/browser/browser_partitionedLockManager.js | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/toolkit/components/antitracking/test/browser/browser_partitionedLockManager.js b/toolkit/components/antitracking/test/browser/browser_partitionedLockManager.js new file mode 100644 index 0000000000..21c3c9637d --- /dev/null +++ b/toolkit/components/antitracking/test/browser/browser_partitionedLockManager.js @@ -0,0 +1,30 @@ +/* import-globals-from partitionedstorage_head.js */ + +PartitionedStorageHelper.runTest( + "LockManager works in both first and third party contexts", + async (win3rdParty, win1stParty, allowed) => { + let locks = []; + ok(win1stParty.isSecureContext, "1st party is in a secure context"); + ok(win3rdParty.isSecureContext, "3rd party is in a secure context"); + await win1stParty.navigator.locks.request("foo", lock => { + locks.push(lock); + ok(true, "locks.request succeeded for 1st party"); + }); + + await win3rdParty.navigator.locks.request("foo", lock => { + locks.push(lock); + ok(true, "locks.request succeeded for 3rd party"); + }); + + is(locks.length, 2, "We should have granted 2 lock requests at this point"); + }, + async _ => { + await new Promise(resolve => { + Services.clearData.deleteData(Ci.nsIClearDataService.CLEAR_ALL, value => + resolve() + ); + }); + }, + /* extraPrefs */ undefined, + { runInSecureContext: true } +); |