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

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

Open
dschuff opened this issue Apr 9, 2024 · 1 comment

Comments

@dschuff
Copy link
Member

dschuff commented Apr 9, 2024

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.

@dschuff dschuff changed the title [JS API] [JS API] 'run a host function' and 'create a host function' don't consistently handle completion records Apr 9, 2024
@Ms2ger
Copy link
Collaborator

Ms2ger commented Apr 10, 2024

Agree that some clarification could be helpful here. Generally outside of JS and prose that interfaces with it closely, notably when using WebIDL, we use the infra convention. Not sure where we might switch between the conventions.

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

No branches or pull requests

2 participants