Skip to content

[js-api] WebAssembly.Exception.getArg(): missing tag parameter? #2052

@woess

Description

@woess

In the current js-api (v2) spec draft, the getArg method on WebAssembly.Exception is defined asgetArg(unsigned long index), not requiring a tag:

any getArg([EnforceRange] unsigned long index);

spec/document/js-api/index.bs

Lines 1754 to 1765 in 1d3e26f

The <dfn method for="Exception">getArg(|index|)</dfn> method steps are:
1. Let |store| be the [=surrounding agent=]'s [=associated store=].
1. Let |tagaddr| be [=exn_tag=](|store|, **this**.\[[Address]]).
1. Let |payload| be [=exn_read=](|store|, **this**.\[[Address]]).
1. Assert: |tagaddr| is equal to **this**.\[[Type]].
1. If |index| ≥ |payload|'s [=list/size=],
1. Throw a {{RangeError}}.
1. Let [|types|] → [] be [=tag_type=](|store|, |tagaddr|).
1. If |types|[|index|] [=matches/valtype|matches=] [=v128=] or [=exnref=],
1. Throw a {{TypeError}}.
1. Return [=ToJSValue=](|payload|[|index|]).

This does not align with the description in Exceptions.md and current browser implementations that expect a Tag argument:

any getArg(Tag tag, unsigned long index);

to query if the `Exception` matches a given tag. The `getArg` method allows
access to the data fields of a `Exception` if a matching tag is given. This last

It's not entirely clear to me if this is a spec bug or an intentional change that has not been adopted in implementations yet. Either way, one of the two documents needs to be fixed.

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