LibWeb: Start implementing serviceWorker.register

This is mostly the fun boilerplate. Actually creating the Job queue
to do the heavy lifting is next.
This commit is contained in:
Andrew Kaster 2024-09-14 21:24:41 -06:00 committed by Tim Ledbetter
commit c77d9a2732
Notes: github-actions[bot] 2024-09-20 21:42:18 +00:00
7 changed files with 163 additions and 1 deletions

View file

@ -0,0 +1,20 @@
<!DOCTYPE html>
<script src="../include.js"></script>
<script>
asyncTest(done => {
spoofCurrentURL("https://example.com/service-worker-register.html");
let swPromise = navigator.serviceWorker.register("service-worker.js");
swPromise
.then(registration => {
println(`ServiceWorker registration successful with scope: ${registration.scope}`);
done();
})
.catch(err => {
println(`ServiceWorker registration failed: ${err}`);
done();
});
});
</script>

View file

@ -0,0 +1,2 @@
// FIXME: Add service worker code here
console.log("hi from service worker");