11cb0ef41Sopenharmony_ci// META: global=window,worker 21cb0ef41Sopenharmony_ci// META: script=/wasm/jsapi/wasm-module-builder.js 31cb0ef41Sopenharmony_ci 41cb0ef41Sopenharmony_cilet emptyModuleBinary; 51cb0ef41Sopenharmony_cisetup(() => { 61cb0ef41Sopenharmony_ci emptyModuleBinary = new WasmModuleBuilder().toBuffer(); 71cb0ef41Sopenharmony_ci}); 81cb0ef41Sopenharmony_ci 91cb0ef41Sopenharmony_cifor (const method of ["compileStreaming", "instantiateStreaming"]) { 101cb0ef41Sopenharmony_ci promise_test(t => { 111cb0ef41Sopenharmony_ci const buffer = new Uint8Array(Array.from(emptyModuleBinary).concat([0, 0])); 121cb0ef41Sopenharmony_ci const response = new Response(buffer, { headers: { "Content-Type": "application/wasm" } }); 131cb0ef41Sopenharmony_ci return promise_rejects_js(t, WebAssembly.CompileError, WebAssembly[method](response)); 141cb0ef41Sopenharmony_ci }, `Invalid code (0x0000): ${method}`); 151cb0ef41Sopenharmony_ci 161cb0ef41Sopenharmony_ci promise_test(t => { 171cb0ef41Sopenharmony_ci const buffer = new Uint8Array(Array.from(emptyModuleBinary).concat([0xCA, 0xFE])); 181cb0ef41Sopenharmony_ci const response = new Response(buffer, { headers: { "Content-Type": "application/wasm" } }); 191cb0ef41Sopenharmony_ci return promise_rejects_js(t, WebAssembly.CompileError, WebAssembly[method](response)); 201cb0ef41Sopenharmony_ci }, `Invalid code (0xCAFE): ${method}`); 211cb0ef41Sopenharmony_ci} 22