Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding service workers to specs #3

Closed
14 of 15 tasks
domenic opened this issue Jan 12, 2017 · 5 comments
Closed
14 of 15 tasks

Adding service workers to specs #3

domenic opened this issue Jan 12, 2017 · 5 comments

Comments

@domenic
Copy link
Member

domenic commented Jan 12, 2017

Specs to add service worker to:

Special:

  • HTML

Easy:

  • Infra
  • DOM
  • Fullscreen
  • Notifications
  • Fetch
  • MIME Sniffing
  • XMLHttpRequest
  • Storage
  • Quirks Mode

Need to start using the deploy script first (#11):

  • URL
  • Encoding
  • Compatibility
  • Console
  • Streams (has one, but it's a one-off created for streams)

The best path here might be to fix #11, then add the service worker registration to the Bikeshed template, instead of doing individual PRs like whatwg/dom#476


Original post follows:

I did this for streams with some success in whatwg/streams#637. Some thoughts:

  • Maybe we should work to implement the more complicated strategy discussed at Meta: add a service worker to the spec streams#637 (comment) before rolling this out everywhere?
  • Is there any way to deduplicate the code? Given that it has to be hosted on the same origin, it seems unlikely. Hmm, I guess importScripts works cross-origin? So then we'd just reduce the actual in-spec code to something like self.toCache = ... or maybe we could even get rid of that by inferring the logo filename from the origin.
@jakearchibald
Copy link

Brain fart: The cache could be built dynamically.

Eg, the cache name could be spec- plus the html url, plus the etag/last-modified of the html responses. Resources fetched from that page (images & js) would be added to a cache of the same name.

Once a new version of the spec is discovered, the old cache is deleted.

It's not as atomic as handling everything in install/activate events but it could work for simple pages like specs.

domenic added a commit to whatwg/resources.whatwg.org that referenced this issue Apr 4, 2017
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.
domenic added a commit to whatwg/resources.whatwg.org that referenced this issue Jun 22, 2017
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.
domenic added a commit to whatwg/resources.whatwg.org that referenced this issue Jul 18, 2017
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.
@domenic
Copy link
Member Author

domenic commented Jul 18, 2017

This was deployed successfully for whatwg/dom in whatwg/dom#476.

I'll update the OP with a checklist. Note that resources apart from the default set won't be cacheable without more deploy script work in the vein of #11.

@domenic
Copy link
Member Author

domenic commented Jan 5, 2018

This was done for everything but HTML as part of #23. (As noted there, Encoding is currently blocked; see whatwg/encoding#132.)

We'll leave this open to track HTML though.

@annevk
Copy link
Member

annevk commented Mar 25, 2020

Now that Encoding is done, maybe this should move to html-build or html directly?

@annevk
Copy link
Member

annevk commented Jun 13, 2020

whatwg/html-build#238

@annevk annevk closed this as completed Jun 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants