Re: [w3c/ServiceWorker] importScripts() on ServiceWorkerGlobalScope (#1319)

Asking for some guidance, please, now that #1585 tries to allow a dynamic `import()`: should I open a new issue for allowing a late importScripts or maybe someone else can do it? AFAICT the use case here is the same: importing an arbitrary **local** script on demand at a later point in time.

This is crucial for complex browser extensions based on a service worker (ManifestV3 in Chrome) and not using ES modules. Previously, extensions were using a standard `Window` environment for their background script and we could load arbitrary code via a DOM `script` element so an extension's main background script was small and fast to load on an event, it would then look at the message/event, dynamically load the necessary script, and let the latter handle the event. Complex scripts may have megabytes of code and to make things worse, Chrome doesn't allow code compilation cache for extensions to avoid privilege escalation attacks.


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

Received on Monday, 7 June 2021 12:23:44 UTC