Open
Conversation
28b5a43 to
5dd1fa8
Compare
1a4eb4a to
e60b5e6
Compare
5dd1fa8 to
d25d1b6
Compare
d25d1b6 to
752a6cb
Compare
63bf2e0 to
d7bcc6f
Compare
75e8e74 to
5557abc
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 newHostGetModuleSourceModuleRecordhost hook andGetModuleSourceModuleRecordconcrete method.import(moduleSource)based on the updatedHostLoadImportedModuleAPI, with full registry key coalescing based on module source equivalence via the newModuleSourcesEqualconcrete method.ModuleSourcesEqualcheck, only registry rooted sources are treated as equivalent in this check, which have arooted sourcevalue. These correspond to "evalish" modules. See the security section below for more info.postMessage(moduleSource)based on supported structured serialize and deserialize for JS source objects with a[[SourceTextModuleRecord]]slot (Wasm's support already being defined in https://www.w3.org/TR/wasm-web-api-2/ as always being unrooted transfer, yet to be updated to support rooted transfer in turn).This is based to the latest version of ESM Phase Imports (https://tc39.es/proposal-esm-phase-imports/).
The WebAssembly ESM Integration side of this has now been landed including support in
HostGetModuleRecordFromSourcebeing able to synthesize a module record when needed forimport()ornew Worker().In order to extend WebAssembly's structured clone of
WebAssembly.Moduleto also support serialization of the URL an rooted source properties of the WebAssembly module script, the associated PR to the Wasm Web API is needed - WebAssembly/esm-integration#106. This PR also definesModuleSourcesEqualfor WA.Module needed for registry identity with structured clone semantics.There is some discussion to be had around the security model here, to outline the approach:
rooted sourceto distinguish between sources known by the host to have been provided from the module registry to their base URL directly to the origin and evalish / compiled sources (egnew WebAssembly.Module(bytes)today and in futureeval('module {...}')ornew ModuleSource('export var foo')).responseURLdoes not match theirbaseURLfor consistency with the rooted source semantics.rooted source, and otherwise set the worker URL to null.postMessagea module created dynamically eg vianew WebAssembly.Module(bytes), we transfer the rooted source status and then transfer baseURL from the parent to the child along with the module only when it is a rooted source. This way, for rooted sources, relative paths that worked in the parent can still work in the child.Shared workers and worklets are not currently supported but could be nice additions.