Skip to content

[JS API] 'run a host function' and 'create a host function' don't consistently handle completion records #1743

Open
@dschuff

Description

@dschuff

The algorithm for run a host function
uses ReturnIfAbrupt ([=?=]) when calling the underlying JS function (meaning it can just return the completion record), or otherwise returns the result value(s) converted with ToWebAssemblyValue. But 'create a host function' just treats its result value as a completion record when it asserts that the type is normal or throw and returns result.Value. Maybe 'run a host function' should just convert the JS results to WebAssembly values as it does now and put them back into result.Value, and return the whole completion record.

I noticed this while while working on WebAssembly/exception-handling#301 which changes some of this code. We could just fix the issue there, which would simplify merging the EH proposal into the spec. Or we could fix it in both places.

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