This PR addresses issue #501 and adjust DefaultValue in the JS API so that it delegates to a embedder API function in the core spec, with a special case for externref to use undefined.
Note that for anyref and other non-externref types it will use null as the default value. For non-null types, it produces error and that is thrown as a TypeError for WebAssembly.Table.prototype.set and WebAssembly.Table.prototype.grow.
Rendered spec change for the core spec:
Rendered change for DefaultValue (there are changes to use sites too, not shown):
The PR also adds a new WPT test for the error cases specifically. Both Firefox and Chrome passed the test when I tried it out.
This PR addresses issue #501 and adjust
DefaultValue
in the JS API so that it delegates to a embedder API function in the core spec, with a special case forexternref
to useundefined
.Note that for
anyref
and other non-externref types it will usenull
as the default value. For non-null types, it produceserror
and that is thrown as aTypeError
forWebAssembly.Table.prototype.set
andWebAssembly.Table.prototype.grow
.Rendered spec change for the core spec:
Rendered change for
DefaultValue
(there are changes to use sites too, not shown):The PR also adds a new WPT test for the error cases specifically. Both Firefox and Chrome passed the test when I tried it out.