summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/wasm/webapi/body.any.js
diff options
context:
space:
mode:
Diffstat (limited to 'testing/web-platform/tests/wasm/webapi/body.any.js')
-rw-r--r--testing/web-platform/tests/wasm/webapi/body.any.js19
1 files changed, 19 insertions, 0 deletions
diff --git a/testing/web-platform/tests/wasm/webapi/body.any.js b/testing/web-platform/tests/wasm/webapi/body.any.js
new file mode 100644
index 0000000000..4db7e8d123
--- /dev/null
+++ b/testing/web-platform/tests/wasm/webapi/body.any.js
@@ -0,0 +1,19 @@
+// META: global=window,worker
+// 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_js(t, 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_js(t, TypeError, promise);
+ }, `${method} before consumption`);
+}