Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- This WPT test may be referenced by the following Test IDs:
- /wasm/webapi/invalid-args.any.html - WPT Dashboard Interop Dashboard
- /wasm/webapi/invalid-args.any.serviceworker.html - WPT Dashboard Interop Dashboard
- /wasm/webapi/invalid-args.any.sharedworker.html - WPT Dashboard Interop Dashboard
- /wasm/webapi/invalid-args.any.worker.html - WPT Dashboard Interop Dashboard
// 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`);
}
}