- From: Jake Archibald <notifications@github.com>
- Date: Tue, 19 May 2015 07:23:21 -0700
- To: slightlyoff/ServiceWorker <ServiceWorker@noreply.github.com>
- Message-ID: <slightlyoff/ServiceWorker/issues/614/103519643@github.com>
I'm a little confused by the 24hr thing. A SW is checked for updates on navigation, so: 1. User navigates to broken page 1. SW serves up "hello world" 1. SW checks for updates, finds update, skips waiting, and tells clients to reload (https://github.com/slightlyoff/ServiceWorker/issues/681#issuecomment-103512559) Step 2 would only be skipped if the ServiceWorker was served with a max-age and was still considered fresh. For this use-case, I don't see a benefit to unregistering rather than fixing the SW. If an evil user has managed to install a SW on another site, the other site probably wants to unregister it pretty fast, but that's still just: 1. User navigates to hacked page 1. SW serves up "l33t hacked" 1. SW checks for updates, finds update, skips waiting, unregisters, and tells clients to reload (https://github.com/slightlyoff/ServiceWorker/issues/681#issuecomment-103512559) So the new SW would be: ```js self.oninstall = _ => self.skipWaiting(); self.onactivate = _ => { self.registration.unregister().then(_ => client.getAll()).then(clients => clients.map(c => c.navigate())); }; ``` --- Reply to this email directly or view it on GitHub: https://github.com/slightlyoff/ServiceWorker/issues/614#issuecomment-103519643
Received on Tuesday, 19 May 2015 14:23:52 UTC