JS API for Table.grow should take optional second argument for init value
Categories
(Core :: JavaScript: WebAssembly, enhancement, P3)
Tracking
()
Tracking | Status | |
---|---|---|
firefox67 | --- | fixed |
People
(Reporter: lth, Assigned: lth)
References
Details
(Keywords: dev-doc-needed)
Attachments
(3 files, 2 obsolete files)
10.88 KB,
patch
|
luke
:
review+
|
Details | Diff | Splinter Review |
10.89 KB,
patch
|
lth
:
review+
|
Details | Diff | Splinter Review |
47 bytes,
text/x-phabricator-request
|
Details | Review |
Assignee | ||
Updated•6 years ago
|
Updated•6 years ago
|
Assignee | ||
Comment 1•6 years ago
|
||
Assignee | ||
Comment 2•6 years ago
|
||
Assignee | ||
Comment 3•6 years ago
|
||
Assignee | ||
Comment 4•6 years ago
|
||
Comment 5•6 years ago
|
||
Assignee | ||
Comment 6•6 years ago
|
||
Comment 7•6 years ago
|
||
Comment 8•6 years ago
|
||
Assignee | ||
Comment 9•6 years ago
|
||
Assignee | ||
Comment 10•6 years ago
|
||
Comment 11•6 years ago
|
||
Assignee | ||
Comment 13•6 years ago
|
||
This is about to land.
For the documentation team:
WebAssembly.prototype.grow(delta, [init])
where delta
is an integer (as before) and init is an optional initialization value for new slots, defaulting to null. For tables of anyfunc (ie all tables at the moment) the init value can explicitly be null or a function that was exported by some Wasm module instance. If it is not, then this function throws.
Assignee | ||
Comment 14•6 years ago
|
||
There's a wrinkle here wrt WPT since we're technically changing an API:
- The existing test case in grow.any.js that tests that a bogus but unused second argument is allowed will succeed when the old table API is present but will fail when the new api is present (which is nightly-only for now)
- There will be new test cases that will fail when the old table API is present but will succeed when the new API is present
For the jit-tests I have all sorts of predicates to handle this, but how do i best handle it in wpt?
If I just land the changes to the tests they'll start failing when we merge to beta and/or upstream the tests, as the new APIs won't exist there. But can we handle that with .ini files on beta and can other browsers handle it with .ini files in their own repos, or is this too clunky?
Comment 15•6 years ago
|
||
(In reply to Lars T Hansen [:lth] from comment #14)
There's a wrinkle here wrt WPT since we're technically changing an API:
- The existing test case in grow.any.js that tests that a bogus but unused second argument is allowed will succeed when the old table API is present but will fail when the new api is present (which is nightly-only for now)
Changing the test to pass three arguments is fine; it's meant to fail if implementations have an argc == expected_args
check rather than argc >= expected_args
.
- There will be new test cases that will fail when the old table API is present but will succeed when the new API is present
Is there a spec for this at all? If not, I'd suggest adding a new file called foo.tentative.any.js
, preferably with a pointer back to this bug or whatever place you're discussing the API.
For the jit-tests I have all sorts of predicates to handle this, but how do i best handle it in wpt?
If I just land the changes to the tests they'll start failing when we merge to beta and/or upstream the tests, as the new APIs won't exist there. But can we handle that with .ini files on beta and can other browsers handle it with .ini files in their own repos, or is this too clunky?
We can certainly use the release_or_beta predicate like https://searchfox.org/mozilla-central/rev/ee40541496d3ad738097eebadaf4965ca1343b7a/testing/web-platform/meta/worklets/audio-worklet-credentials.https.html.ini#6 for ourselves. Other browsers need to handle expected-to-fail tests anyway, so this shouldn't be a problem.
As for the stability-check orange, I filed https://bugzilla.mozilla.org/show_bug.cgi?id=1528735.
Assignee | ||
Comment 16•6 years ago
|
||
(In reply to :Ms2ger (he/him; ⌚ UTC+1/+2) from comment #15)
(In reply to Lars T Hansen [:lth] from comment #14)
There's a wrinkle here wrt WPT since we're technically changing an API:
- The existing test case in grow.any.js that tests that a bogus but unused second argument is allowed will succeed when the old table API is present but will fail when the new api is present (which is nightly-only for now)
Changing the test to pass three arguments is fine; it's meant to fail if implementations have an
argc == expected_args
check rather thanargc >= expected_args
.
Righto. So I'll just add a second null argument before the {} argument and we'll be fine.
- There will be new test cases that will fail when the old table API is present but will succeed when the new API is present
Is there a spec for this at all?
Sort of. It's emerging, and mostly stable, but I think we're the first to implement this bit.
If not, I'd suggest adding a new file called
foo.tentative.any.js
, preferably with a pointer back to this bug or whatever place you're discussing the API.
Will do.
For the jit-tests I have all sorts of predicates to handle this, but how do i best handle it in wpt?
If I just land the changes to the tests they'll start failing when we merge to beta and/or upstream the tests, as the new APIs won't exist there. But can we handle that with .ini files on beta and can other browsers handle it with .ini files in their own repos, or is this too clunky?
We can certainly use the release_or_beta predicate like https://searchfox.org/mozilla-central/rev/ee40541496d3ad738097eebadaf4965ca1343b7a/testing/web-platform/meta/worklets/audio-worklet-credentials.https.html.ini#6 for ourselves. Other browsers need to handle expected-to-fail tests anyway, so this shouldn't be a problem.
That will work very well.
As for the stability-check orange, I filed https://bugzilla.mozilla.org/show_bug.cgi?id=1528735.
Thanks for that, I'll point the sheriffs in that direction if somebody makes a fuss.
Comment 17•6 years ago
|
||
Assignee | ||
Comment 18•6 years ago
|
||
Landed w/o WPT tests since there are some issues with getting those to stick, hope to land them in a day or so.
Assignee | ||
Comment 19•6 years ago
|
||
Test cases for evolving JSAPI for the wasm reference types proposal:
the grow() method on a table can now take a second argument. It can
be null or an exported wasm function and it is used to initialize the
new table slots.
These tests are set apart from the regular test to make it clear that
they are tentative. Once the reftypes proposal ships we should merge
them into table/grow.any.js.
Comment 22•6 years ago
|
||
bugherder |
Comment 24•6 years ago
|
||
Assignee | ||
Updated•6 years ago
|
Comment 26•6 years ago
|
||
bugherder |
Updated•4 years ago
|
Comment 27•4 years ago
|
||
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/Table/grow needs update
Description
•