feat: ServiceWorkerMain (#45232)

* feat: ServiceWorkerMain

* refactor: disconnect remote

* handle version_info_ nullptr case

* initiate finish request when possible and enumerate errors

* explicit name for test method

* oops

* fix: wait for redundant version to stop before destroying

* docs: clarify when undefined is returned

* chore: remove extra semicolons
This commit is contained in:
Sam Maddock 2025-01-24 08:33:44 -05:00 committed by GitHub
parent 75eac86506
commit a467d0684e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
23 changed files with 1265 additions and 50 deletions

View file

@ -2,7 +2,8 @@
<html lang="en">
<body>
<script>
navigator.serviceWorker.register('sw.js', {
let scriptUrl = new URLSearchParams(location.search).get('scriptUrl') || 'sw.js';
navigator.serviceWorker.register(scriptUrl, {
scope: location.pathname.split('/').slice(0, 2).join('/') + '/'
})
</script>

View file

@ -0,0 +1 @@
throw new Error('service worker throwing on startup');

View file

@ -0,0 +1,3 @@
self.addEventListener('install', function () {
registration.unregister();
});