Skip to content

Unclear meaning of "is exnref" in JS API #1909

Open
@bvisness

Description

@bvisness

ToJSValue asserts that the input type is neither v128 nor ref.exn exnaddr. To enforce this, there are several places in the spec that say something like "If resultType is v128 or exnref, throw a TypeError." Unfortunately it's not really clear what "exnref" encompasses here.

Specifically, a bug was submitted to SpiderMonkey expecting that the following function would result in unreachable executed instead of TypeError:

(func (result nullexnref)
  unreachable
)

There's a case to be made for this, because ToJSValue asserts that no values are of the form ref.exn exnaddr and states that any value of the form ref.null t should be converted to JS null. nullexnref (and technically (ref noexn)) would therefore work fine. But neither Firefox nor Chrome currently allows noexn in parameters or results. (I haven't tested in other engines.)

Should we clarify that "is exnref" means "is a subtype of exnref" or "is a reference type in the exn hierarchy" or something to that effect? It doesn't seem worth it to support nullexnref but not exnref, especially when major engines already consider this an error.

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