Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

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

Open
#1,743 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
42/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
javascript, wasm
Domain
api, compilers

Research direction

Read document/js-api/index.bs at the linked run-a-host-function algorithm and compare it with create-a-host-function, then review exception-handling PR #301 for the overlapping change. Done means the completion-record behavior is consistent in both locations and the specification changes integrate with that proposal.

Written by the indexing model from the issue text.

Description

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 https://github.com/WebAssembly/exception-handling/pull/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.

Dominant language
WebAssembly
Stars
3.5k
Forks
540
Avg merge
11h 12m
Merged PRs (30d)
11

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from WebAssembly/spec

All issues in WebAssembly/spec

Similar issues

More Backend & API Design issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.