1// META: global=window,worker 2 3const invalidArguments = [ 4 [() => new Response(undefined, { headers: { "Content-Type": "application/wasm" } }), "no body"], 5 [() => new Response("", { headers: { "Content-Type": "application/wasm" } }), "empty body"], 6]; 7 8for (const method of ["compileStreaming", "instantiateStreaming"]) { 9 for (const [argumentFactory, name] of invalidArguments) { 10 promise_test(t => { 11 const argument = argumentFactory(); 12 return promise_rejects_js(t, WebAssembly.CompileError, WebAssembly[method](argument)); 13 }, `${method}: ${name}`); 14 15 promise_test(t => { 16 const argument = Promise.resolve(argumentFactory()); 17 return promise_rejects_js(t, WebAssembly.CompileError, WebAssembly[method](argument)); 18 }, `${method}: ${name} in a promise`); 19 } 20} 21