Is it possible to extend the webview service worker?

We would like to implement some of our webview functionality in the service worker, and we found that Theia is already registering a SW for the webviews, and we can’t register another one.
Is it possible then to use the extension mechanism to extend the service worker with additional features?
If so, can you give us some pointers as to where to look for contribution points?


@drochgenius thank you for the discussion!

I never tried myself, but I believe any of the following should work:

  • replace the index.html (which references the service-worker) to your custom implementation without the need for dependency injection
  • extend WebviewWidget itself to provide a custom implementation and index.html (might be overkill for this use-case)

The service-worker from what I can tell is simply a JS script, so you should have control over it, it’s just not extensible in the same way as other components in the framework through dependency injection.