Skip to content

WebAssembly.{compile|instantiate}Streaming: what if embedder doesn't implement it? #1085

@mtrofin

Description

@mtrofin

In Chrome, we're implementing the 2 streaming APIs in v8, on the WebAssembly object (as per spec), and inject the actual implementation from Chrome. This is for layering reasons. I'm assuming we're not alone in taking this approach.

What do we want to do if the embedder "forgets" to inject a dependency? This scenario is unlikely, but may happen in non-web embeddings. A developer porting code to node.js, for example, may hit this situation.

Options:

  1. quietly return undefined (weird, no indication of what just happened)
  2. throw RangeError (we did that for browser limits for sync compilation, but it is weird because why "Range" in this case?)
  3. throw Error with a nice description
  4. behave as-if the API didn't exist (that'd be weird, because the API is testably present)
  5. crash (this is also weird, why such drastic measures when calling an API)

Personal preference: option 3.

Thoughts?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions