worker-termination.https.html (446B)
1 <!DOCTYPE html> 2 <html class="test-wait"> 3 <meta charset="utf-8"> 4 <script> 5 var worker = new Worker(URL.createObjectURL(new Blob([` 6 postMessage("hi"); 7 (async () => { 8 const abort = new AbortController() 9 await navigator.locks.request("weblock_0", { signal: abort.signal }, () => {}) 10 })() 11 `]))); 12 worker.onmessage = () => { 13 worker.terminate(); 14 document.documentElement.classList.remove("test-wait"); 15 }; 16 </script>