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

Worker client hint set should be updated at some point? #43

Open
amtunlimited opened this issue Jan 15, 2021 · 3 comments
Open

Worker client hint set should be updated at some point? #43

amtunlimited opened this issue Jan 15, 2021 · 3 comments
Labels
enhancement New feature or request

Comments

@amtunlimited
Copy link
Collaborator

amtunlimited commented Jan 15, 2021

I just noticed that a worker's client hint is set at initialization, but workers can live beyond multiple top-level navigations. We should decide if/when/where a worker's client hint set is updated/reinitialized

@wanderview
Copy link

I believe service workers should probably be treated like their own top level "document" for client hints. They are not associated with any single other document and can exist without a document at all.

It would probably be most straightforward to give the service worker client hints based on Accept-CH headers on the service worker script response itself. Since the response is persisted, these could be applied every time the script is loaded. Sites would have to update their script to apply new CHs to the service worker.

This would allow sites to explicitly control the CHs for fetch's made during the service worker install event and arbitrary other fetches from the service worker. If the service worker does fetch(FetchEvent.request), though, the CHs for that request should come from the FetchEvent.request.

If necessary we could also consider possibly making changes to the Accept-CH headers trigger the installation of a new script. Right now we only install a new service worker version if the bytes in the body of the script change.

@wanderview
Copy link

I would also recommend doing the same for SharedWorker since its list of associated documents may change over time.

I'm less opinionated about DedicatedWorker, but it would be nice to be consistent there. It would also automatically handle the case where DedicatedWorkers are nested under SharedWorker or ServiceWorker in the future (something we want to support).

@amtunlimited
Copy link
Collaborator Author

cc @davidben @yoavweiss

@arichiv arichiv added the enhancement New feature or request label Jan 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants