Skip to content

Commit

Permalink
[wasm] Add test for Global constructor with v128.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ms2ger committed May 2, 2022
1 parent 647e21f commit 5452375
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions wasm/jsapi/global/constructor.any.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,11 @@ test(() => {
}
}, "Invalid type argument");

test(() => {
const argument = { "value": "v128" };
assert_throws_js(WebAssembly.LinkError, () => new WebAssembly.Global(argument));

This comment has been minimized.

Copy link
@gahaas

gahaas May 12, 2022

Contributor

Why is this a WebAssembly.LinkError, and not a TypeError as above?

This comment has been minimized.

Copy link
@Ms2ger

Ms2ger May 12, 2022

Author Contributor

That's what the spec says: https://webassembly.github.io/spec/js-api/#dom-global-global ; I don't recall reviewing the change, but blame can probably tell you how it ended up there.

This comment has been minimized.

Copy link
@gahaas

gahaas May 12, 2022

Contributor

I think this was an error that nobody spotted. In https://github.com/WebAssembly/simd/blob/master/proposals/simd/SIMD.md#global-constructor it should be a TypeError, and in the pull request it just refers to this document. I will create a PR to fix it in the spec. After that I will fix it here, and then import the tests again in the spec repo.

}, "Construct v128 global");

test(() => {
const argument = { "value": "i64" };
const global = new WebAssembly.Global(argument);
Expand Down

0 comments on commit 5452375

Please sign in to comment.