Skip to content

Define ModuleNamespace to ECMA-262 Module Namespace Exotic Object #1483

New issue

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

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

Already on GitHub? # to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

guybedford
Copy link

@guybedford guybedford commented Apr 8, 2025

This came up in a PR addition to the WebAssembly ESM Integration in WebAssembly/esm-integration#104 to have a WebIDL function definition returning a ModuleNamespace object (namespaceInstance below):

interface Instance {
  constructor(Module module, optional object importObject);
  readonly attribute object exports;
  static Instance namespaceInstance(ModuleNamespace moduleNamespace);
};

To support this it would be beneficial to have an upstream definition of ModuleNamespace to ensure validations are handled at the WebIDL layer for functions taking module namespaces as arguments.

The PR has not landed yet, posting this up for initial feedback before the ESM Integration PR lands.

  • At least two implementers are interested (and none opposed):
  • Tests are written and can be reviewed and commented upon at:
  • Implementation bugs are filed:
    • Chromium: …
    • Gecko: …
    • WebKit: …
    • Deno: …
    • Node.js: …
    • webidl2.js: …
    • widlparser: …
  • MDN issue is filed: …
  • The top of this comment includes a clear commit message to use.

(See WHATWG Working Mode: Changes for more details.)


Preview | Diff

@annevk
Copy link
Member

annevk commented Apr 9, 2025

This looks okay to me, but the template will have to be filled in. One caveat here I guess is that Wasm JS API bindings are not actually implemented through IDL in (most?) implementations.

@guybedford
Copy link
Author

Thanks for taking a look and I believe you're right on the implementation aspects. The alternative would be to just use object and then to define the validations in line, but this seemed better if possible, unless you can see any reasons against having this defined here.

I'll aim to get the Node.js implementation together and post back the template with an update when that's ready.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants