Re: [w3c/ServiceWorker] allow service workers to created nested dedicated workers (#1529)

I’d like to emphasize that both shared workers and service-workers-spawning-workers are important.

This issue covers many use cases that shared workers do not address, particularly with those described in https://github.com/w3c/ServiceWorker/issues/1529#issuecomment-2641345477 – i.e., fetch handling that requires relatively long-running sync calls. Shared workers wouldn’t help with fetches using data from SQLite or other OPFS sync access; they wouldn’t help with transparent decoding/decompression of unsupported file formats or with async expensive RegExp processing for URL routing either.

If Chrome Android supported shared workers, that would help many other use cases that also currently require complex tab leader election and locking. But shared workers don’t address many important use cases in this thread. Even with broad shared-workers support—if we want to enable important fetch-related use cases, then we still need dedicated workers spawned by dedicated workers.

***

@asutherland: I largely agree with the ideas in https://github.com/w3c/ServiceWorker/issues/1529#issuecomment-2643492051. I’m a little confused by what you mean by “enforcement mechanism”—do you mean how the last update check time can get updated—e.g., by `importScripts(urls)`? (Related comment by @jeffposnick from the `import()` issue: https://github.com/w3c/ServiceWorker/issues/1585#issuecomment-825827457.) 

I can see it being a developer footgun if a change in a JS resource didn’t trigger an update in a service worker that used it as a dedicated worker…but it also probably would be a footgun if JS modules didn’t use the same module cache as the service worker’s statically `import`ed modules. 

I definitely think that `new Worker`’s SW-update-triggering behavior (or lack thereof) should be consistent whether or not it uses `type: "module"`. I think I agree that it would be simpler to just use the same module cache system—which would mean that changes to dedicated-worker resources wouldn’t contribute to the service worker’s update check, whether or not the dedicated worker is a module.


-- 
Reply to this email directly or view it on GitHub:
https://github.com/w3c/ServiceWorker/issues/1529#issuecomment-2644726140
You are receiving this because you are subscribed to this thread.

Message ID: <w3c/ServiceWorker/issues/1529/2644726140@github.com>

Received on Saturday, 8 February 2025 08:43:58 UTC