gecko-dev/testing/web-platform/tests/wasm/webapi/body.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

20 lines
864 B
JavaScript

// META: global=window,worker
// META: script=/wasm/jsapi/wasm-constants.js
// META: script=/wasm/jsapi/wasm-module-builder.js
for (const method of ["compileStreaming", "instantiateStreaming"]) {
promise_test(t => {
const buffer = new WasmModuleBuilder().toBuffer();
const argument = new Response(buffer, { headers: { "Content-Type": "application/wasm" } });
argument.arrayBuffer();
return promise_rejects(t, new TypeError(), WebAssembly[method](argument));
}, `${method} after consumption`);
promise_test(t => {
const buffer = new WasmModuleBuilder().toBuffer();
const argument = new Response(buffer, { headers: { "Content-Type": "application/wasm" } });
const promise = WebAssembly[method](argument);
argument.arrayBuffer();
return promise_rejects(t, new TypeError(), promise);
}, `${method} before consumption`);
}