Open Bug 1247687 Opened 5 years ago Updated 13 days ago

Implement worker modules

Categories

(Core :: DOM: Workers, task)

task
Not set
normal

Tracking

()

People

(Reporter: jonco, Unassigned)

References

(Depends on 2 open bugs, Blocks 3 open bugs)

Details

(Keywords: dev-doc-needed, DevAdvocacy)

Allow workers to execute module scripts too.

Proposed spec: https://github.com/whatwg/html/pull/608
That would be really useful
See Also: → 1473463
Keywords: DevAdvocacy
Duplicate of this bug: 1494055
Duplicate of this bug: 1558780

Does this actually need JS engine changes?

Flags: needinfo?(jcoppeard)

No, all the work is in the embedding.

Component: JavaScript Engine → DOM: Workers
Flags: needinfo?(jcoppeard)

Chromium will send an intent to ship ES modules for Shared Workers.
(crbug: https://bugs.chromium.org/p/chromium/issues/detail?id=824646)

We are considering FireFox is positive for supporting this feature since the specification discussion (https://github.com/whatwg/html/pull/608#issuecomment-183003447).
If there is misunderstanding or any updates, please let us know.

As part of overhauling the scriptloader to support modules we'd also like to try and reduce code duplication between the worker scriptloader and the main-thread window scriptloader. Much of the complexity in the worker scriptloader relates to 2 things:

  1. Channels can't be opened on worker threads. Bug 1528285 will address this so we want to wait on that.
  2. Loading ServiceWorker scripts from Cache API storage does not look like using a channel. For this, a tentative plan to investigate is to create a dedicated channel type for loading scripts from the Cache API. This could help normalize things from the script loader's perspective.
    • This may or may not also dovetail with the need for there to be a Worker equivalent to DocumentChannel for ServiceWorker and SharedWorker cases where we need to know the COEP header value before we select the process to spin up the worker.
Depends on: omt-asyncopen
Depends on: 1311726
See Also: → 1572644
You need to log in before you can comment on or make changes to this bug.