- From: Jungkee Song <notifications@github.com>
- Date: Fri, 10 Apr 2015 01:21:59 -0700
- To: slightlyoff/ServiceWorker <ServiceWorker@noreply.github.com>
- Message-ID: <slightlyoff/ServiceWorker/issues/659/91475273@github.com>
Re https://github.com/slightlyoff/ServiceWorker/issues/659#issuecomment-87778808, here's some investigation about what we do with a registration. (http://slightlyoff.github.io/ServiceWorker/spec/service_worker/sw-registration-figure.svg.) **[Create Registration]** A registration is created only by `navigator.serviceWorker.register()`. **[Update Registration]** The state of the registration can be mutated by: - `navigator.serviceWorker.register()` - `registration.update()` - Soft Update (This can be called by UA internal context and other APIs such as Push API.) **[Delete Registration]** The registration can be deleted by: - `registration.unregister()` - Handle Service Worker Client Unload (when there's no other client left and the uninstalling flag is set.) - **Errors in Update** - **Errors in Install** The first two points in **[Delete Registration]** are explicit, so we may want to check the rest of the points. Here's **the list of errors triggering Clear Registration from Update**: - Request constructor (to prepare fetching script) throws - Network error by detecting a redirect - Script's MIME type mismatch - `Service-Worker-Allowed` header parsing failure - Script's location violation - An uncaught runtime script error when run a worker with the fetched script **The list of errors triggering Clear Registration from Install**: - An uncaught runtime error in the oninstall event listener - Install failure detected by the rejection of waitUntil promise IMO, these errors are mostly something devs need to fix during the development/deployment. (Those can be fixed by the next Update attempt.) In the case of the registration which should be permanently removed, an explicit call to `registration.unregister()` seems reasonable. Also as @jakearchibald pointed out, the registration through the corresponding ServiceWorkerRegistration object is bound to PushManager, SyncManager, GeofenceManager, etc. Are there other concerns that I missed? --- Reply to this email directly or view it on GitHub: https://github.com/slightlyoff/ServiceWorker/issues/659#issuecomment-91475273
Received on Friday, 10 April 2015 08:22:28 UTC