Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Gecko Bug 1686755] Add support for optional parameters in WebAssembly.Table API. #27297

Merged
merged 1 commit into from Jan 23, 2021

Conversation

moz-wptsync-bot
Copy link
Collaborator

The following operations on WebAssembly.Table can take an optional parameter.

  • new WebAssembly.Table(descr, )
  • table.set(index, )
  • table.grow(delta, )

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

The following operations on WebAssembly.Table can take an optional parameter.
 * new WebAssembly.Table(descr, <initvalue>)
 * table.set(index, <newvalue>)
 * table.grow(delta, <initvalue>)

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
Copy link
Collaborator

@wpt-pr-bot wpt-pr-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The review process for this patch is being conducted in the Firefox project.

@moz-wptsync-bot moz-wptsync-bot merged commit 3507745 into master Jan 23, 2021
@moz-wptsync-bot moz-wptsync-bot deleted the gecko/1686755 branch January 23, 2021 10:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants