Skip to content

Commit

Permalink
[wpt][webassembly][jspi] Correct WPT tests for JSPI
Browse files Browse the repository at this point in the history
Corrections that are made by WebAssembly/js-promise-integration#52

- Assert that WebAssembly.promising returns a Function (not WebAssembly.Function)
- Don't assert exact error message for stack overflow.
  • Loading branch information
yurydelendik authored and Ms2ger committed Nov 6, 2024
1 parent caa5c5b commit 45967b9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
4 changes: 1 addition & 3 deletions wasm/jsapi/jspi/js-promise-integration.any.js
Original file line number Diff line number Diff line change
Expand Up @@ -334,9 +334,7 @@ test(() => {
builder.addFunction("export", kSig_v_v).addBody([]).exportFunc();
let instance = builder.instantiate();
let export_wrapper = WebAssembly.promising(instance.exports.export);
let export_sig = export_wrapper.type();
assert_array_equals(export_sig.parameters, []);
assert_array_equals(export_sig.results, ['externref']);
assert_true(export_wrapper instanceof Function);
},"Promising with no return");

promise_test(async () => {
Expand Down
9 changes: 8 additions & 1 deletion wasm/jsapi/jspi/rejects.any.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,14 @@ promise_test(async (t) => {
let instance = builder.instantiate();
let wrapper = WebAssembly.promising(instance.exports.test);

promise_rejects_js(t, RangeError, wrapper(), "Maximum call stack size exceeded");
// Stack overflow has undefined behavior -- check if an exception was thrown.
let thrown = false;
try {
await wrapper();
} catch (e) {
thrown = true;
}
assert_true(thrown);
}, "Stack overflow");

promise_test(async (t) => {
Expand Down

0 comments on commit 45967b9

Please sign in to comment.