node/test/fixtures/wpt/web-locks/resources/partitioned-parent.html
ishabi 062e8b5a74 worker: add web locks api
PR-URL: https://github.com/nodejs/node/pull/58666
Fixes: https://github.com/nodejs/node/pull/36502
Refs: https://w3c.github.io/web-locks
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Ethan Arrowood <ethan@arrowood.dev>
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2025-07-18 07:55:10 -07:00

30 lines
969 B
HTML

<!DOCTYPE html>
<meta charset="utf-8"/>
<meta name="referrer" content="origin">
<script>
async function onLoad() {
// Step 6 and Nested Step 9:
// wpt/web-locks/partitioned-web-locks.tentative.https.html
self.addEventListener('message', evt => {
if (self.opener)
self.opener.postMessage(evt.data, '*');
else
self.top.postMessage(evt.data, '*');
}, { once: true });
// Step 3 and Nested Step 3:
// wpt/web-locks/partitioned-web-locks.tentative.https.html
const params = new URLSearchParams(self.location.search);
const frame = document.createElement('iframe');
frame.src = params.get('target');
document.body.appendChild(frame);
// Step 4 and Nested Step 4:
// wpt/web-locks/partitioned-web-locks.tentative.https.html
frame.addEventListener('load', function(){
frame.contentWindow.postMessage({op: 'request',
name: 'testLock', ifAvailable: true}, '*');
});
}
self.addEventListener('load', onLoad);
</script>