In the current implementation, top-level worker script is fetched from the main thread via WorkerClassicScriptLoader and DocumentThreadableLoader (see DedicatedWorker::Start() for example). To avoid dependencies on the main thread, that should be done from the worker thread.
Random notes:
- I assumed that worker script fetch goes through the Blink's memory cache, but it turned out that it's initiated as a RawResource request and bypasses the memory cache. This means we can move worker script fetch to the worker thread without worrying about the memory cache that doesn't work on the worker thread.
- horo@ is now making importScripts() off-main-thread ( issue 706331 ). He found some barriers to do it that may also affect off-main-thread top-level worker script fetch:
https://bugs.chromium.org/p/chromium/issues/detail?id=706331#c21
Comment 1 by nhiroki@chromium.org
, Apr 23 2018