Support Module Source Worker Instantiation #4
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is draft HTML PR spec text to verify the cross-specification interactions of the ESM Source Phase proposal, specifying:
new Worker(moduleSource)
for both JS and Wasm module sources, based on the newHostGetModuleSourceModuleRecord
host hook andGetModuleSourceModuleRecord
concrete method.import(moduleSource)
based on the updatedHostLoadImportedModule
API, with full registry key coalescing based on module source equivalence via the newModuleSourcesEqual
concrete method.postMessage(moduleSource)
based on supported structured serialize and deserialize for JSModuleSource
objects (while this remains defined for Wasm in https://www.w3.org/TR/wasm-web-api-2/, but yet to be updated to support the ESM Phase Imports proposal in turn.This is based to the latest version of ESM Phase Imports (https://tc39.es/proposal-esm-phase-imports/).
The WebAssembly ESM Integration updates to these APIs are not currently included here but should be landed along with this in due course to:
[[ModuleRecord]]
slot on WebAssembly.Module objects to enableHostGetModuleRecordFromSource
HostGetModuleRecordFromSource
that populates this object from the Wasm side when needed (ie when previously compiled modules get passed to source functions such asimport()
ornew Worker()
Finally, the main HTML questions here are around the security properties of source cloning and worker construction. A half-backed
rooted source
property is implemented for module scripts to distinguish between "checked URL sources" and evalish sources, but this needs to still be turned into a proper model further. In addition shared workers and worklets are not currently supported but could be additions to this spec.