Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Module Source Worker Instantiation #4

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

guybedford
Copy link
Owner

@guybedford guybedford commented Nov 15, 2024

This is draft HTML PR spec text to verify the cross-specification interactions of the ESM Source Phase proposal, specifying:

  • Integrating JS module sources with HTML source phase imports
  • new Worker(moduleSource) for both JS and Wasm module sources, based on the new HostGetModuleSourceModuleRecord host hook and GetModuleSourceModuleRecord concrete method.
  • import(moduleSource) based on the updated HostLoadImportedModule API, with full registry key coalescing based on module source equivalence via the new ModuleSourcesEqual concrete method.
  • postMessage(moduleSource) based on supported structured serialize and deserialize for JS ModuleSource 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:

  • Support a [[ModuleRecord]] slot on WebAssembly.Module objects to enable HostGetModuleRecordFromSource
  • Implement a HostGetModuleRecordFromSource that populates this object from the Wasm side when needed (ie when previously compiled modules get passed to source functions such as import() or new Worker()
  • Update Wasm serialization to support URL serialization through this module record object when present

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.

domenic and others added 8 commits November 15, 2024 11:16
Previously, we would only check at the last minute. This would be buggy in the case where we create a new navigable, and then throw an exception. Instead we should be sure to throw before creating a new navigable.

In addition to fixing this somewhat-obviously-wrong bug, this also causes validation to happen before popup blocking or other window-choosing steps. Previously, if trying to open a window to an unparseable URL with the popup blocker active, the window open steps would return null; now, they throw an exception.

Closes whatwg#10681.
This includes two related changes:

1. The showPopover() and togglePopover() methods now include an options bag that allows setting the popover source.

2. Popover sources (declaratively or imperatively set) now create an implicit anchor reference for that popover.

See discussion in whatwg#9144 (comment). Closes whatwg#10442. Closes whatwg#10675.
Cause noopener to be set for window.open(), clicks on <a> / <area> elements, and form submissions where the corresponding blob URL is cross-site to the top-level site of the context performing the action. This corresponds to the discussion in w3c/FileAPI#153.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants