1
0
Fork 0
firefox/testing/web-platform/tests/wasm/webapi/invalid-args.any.js
Daniel Baumann 5e9a113729
Adding upstream version 140.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
2025-06-25 09:37:52 +02:00

28 lines
758 B
JavaScript

// META: global=window,worker
const invalidArguments = [
[undefined],
[null],
[true],
["test"],
[Symbol()],
[0],
[0.1],
[NaN],
[{}, "Empty object"],
[Response, "Response interface object"],
[Response.prototype, "Response interface prototype object"],
];
for (const method of ["compileStreaming", "instantiateStreaming"]) {
for (const [argument, name = format_value(argument)] of invalidArguments) {
promise_test(t => {
return promise_rejects_js(t, TypeError, WebAssembly[method](argument));
}, `${method}: ${name}`);
promise_test(t => {
const promise = Promise.resolve(argument);
return promise_rejects_js(t, TypeError, WebAssembly[method](argument));
}, `${method}: ${name} in a promise`);
}
}