[Gecko Bug 1686755] Add support for optional parameters in WebAssembly.Table API. #27297
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The following operations on WebAssembly.Table can take an optional parameter.
Current support is inconsistent. The constructor didn't support the parameter at
all, the setter always required the parameter, and grow supported the parameter
as optional.
One additional wrinkle is that the behavior for an omitted parameter depends on
the table type. funcref (and presumably eqref, but unspecified) defaults to null
when the value is not specified. externref is to default to undefined. [1]
This behavior is odd, but appears to be required to be backwards compatible with
respect to funcref, and to be consistent with JS semantics of optional parameters
meaning 'undefined' for externref.
[1] https://webassembly.github.io/reference-types/js-api/index.html#dom-table-table
Differential Revision: https://phabricator.services.mozilla.com/D101946
bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1686755
gecko-commit: c50d53e2bcac21751431fe859f2b29dea9672bcf
gecko-reviewers: lth