gecko-dev/testing/web-platform/tests/wasm/webapi/invalid-args.any.js
Ms2ger 0e451caf6c Bug 1501045 [wpt PR 13652] - WebAssembly: Test various arguments., a=testonly
Automatic update from web-platform-testsAdd some tests for invalid arguments to WebAssembly.*Streaming.

--
Test some invalid HTTP statuses.

--
Test cross-origin responses for WebAssembly.

--
Add tests for case differences in the wasm content type.

--
Add a test for empty bodies.

--
Add a test for disturbed bodies.

--
Add a test for passing a rejected Promise.

--
Add some tests for instantiateStreaming().

--

wpt-commits: 99e7a8e331555e0637a2cee1bda193093df36d5b, 700452f6412a17cbf5586dfa24047a164661f89c, 939a2b9916c01fe18c5f240c09e27be1ff99f0b7, f0e55e90830a2fdea4e99e5fc019c959c3f7c982, 06c65c738bba5e0587d1bde349b4601dd8b932ac, b47da4fd4f519b1fe8bd77582ed57d2c5129e62d, 2832c5d39c644281ac644428c8d09c2443602eae, 36ed1aa52242875634e4b33a50e3fded2787656d
wpt-pr: 13652
2018-11-10 09:01:58 +00:00

28 lines
764 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(t, new TypeError(), WebAssembly[method](argument));
}, `${method}: ${name}`);
promise_test(t => {
const promise = Promise.resolve(argument);
return promise_rejects(t, new TypeError(), WebAssembly[method](argument));
}, `${method}: ${name} in a promise`);
}
}