Closed wanderview closed 2 years ago
Thanks for filing this issue; I was just about to do that. :)
I opened an issue on Firefox before realizing that there is no guarantee that resources requested during the Service Worker install phase (e.g. caches.addAll()
) are lower-priority than requests made on the main thread. So it looks like ideally we would want priority hints for cache[s].add[All]
as well.
cache.addAll()
takes Request objects, so it should accept the importance
attribute just like fetch.
There are now specs and examples for how it is exposed on the Request object and used with fetch(). It will work with cache[s].add[All] as well but there aren't any explicit examples of that.
Another use case for priority hints I've heard recently is to de-prioritize
fetch()
andcache.addAll()
calls in a service worker install event. This could help avoid the background installation of many resources from starving out any requests initiated from the active window on the main thread.Just FYI in case this is worth including in the list of use cases in the spec.