-
Notifications
You must be signed in to change notification settings - Fork 23
Add the ability for any spec to have a service worker #53
Conversation
@jakearchibald pointed out a potentially deadly problem with this, which is that as implemented now, no browser will ever update this service worker, even if we update standard-service-worker.js. Since the actual service worker is byte-for-byte identical, it doesn't bother revalidating importScripts()-ed scripts like standard-service-worker.js. This is fixed in the spec but not implementations. We could work around this in the future by writing out a "version" comment in the deploy script if necessary, e.g. add a line like |
Could the comment be automated somehow (maybe include commit hash)? |
Hmm, that might work... to be clear, it'd be the commit hash of standard-service-worker.js from resources.whatwg.org. I wonder how to get that without too much code... |
Part of whatwg/meta#3. This allows any standard using the shared deploy script to automatically get a service worker generated, which delegates all of its logic to a shared file on resources.whatwg.org. It allows room for future expansions of the deploy script to include extra resources. This still requires registering the generated service worker in each spec's HTML, however.
9059df7
to
d8f7379
Compare
I've updated this to add a version comment and be rebased on master. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see any obvious problems, but I'm not as familiar with these things as @jakearchibald is. Happy for you to give this a try though.
Part of whatwg/meta#3. This allows any standard using the shared deploy script to automatically get a service worker generated, which delegates all of its logic to a shared file on resources.whatwg.org. It allows room for future expansions of the deploy script to include extra resources.
This still requires registering the generated service worker in each spec's HTML, however.
On top of #52. To get this working on specs using the new deploy script (e.g. URL), include the following at the bottom of your page:
We could in the future add that our Bikeshed template, once all specs are on the new deploy script (whatwg/meta#11).
I tested this locally, kinda (without the shortname inference), but as usual it'd be best to merge this and try it on specs when multiple people are online.