Skip to content

[js-api] Ambiguity in WebAssembly.instance() importObject requirement with JS builtins imports #2102

Description

@SamVerschueren

The WebAssembly JS-API specification currently states that WebAssembly.Instance() must throw if importObject is undefined while the module declares imports. However, modules that only import JS builtins (for example from the wasm:js-string namespace) do not require an importObject.

The spec text does not clearly define this exception, which leads to inconsistent behavior across implementations. In particular, Firefox currently throws a TypeError in this situation, while Chrome (and I believe Safari) do not.

Currently the spec states

If module.imports is not empty, and importObject is undefined, throw a TypeError exception.

I think the spec should explicitly state that imports satisfied by builtins such as wasm:js-string do not require a user-supplied importObject, even if module.imports is non-empty.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions