tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

invalid-code.any.js (924B)


      1 // META: global=window,worker
      2 // META: script=/wasm/jsapi/wasm-module-builder.js
      3 
      4 let emptyModuleBinary;
      5 setup(() => {
      6  emptyModuleBinary = new WasmModuleBuilder().toBuffer();
      7 });
      8 
      9 for (const method of ["compileStreaming", "instantiateStreaming"]) {
     10  promise_test(t => {
     11    const buffer = new Uint8Array(Array.from(emptyModuleBinary).concat([0, 0]));
     12    const response = new Response(buffer, { headers: { "Content-Type": "application/wasm" } });
     13    return promise_rejects_js(t, WebAssembly.CompileError, WebAssembly[method](response));
     14  }, `Invalid code (0x0000): ${method}`);
     15 
     16  promise_test(t => {
     17    const buffer = new Uint8Array(Array.from(emptyModuleBinary).concat([0xCA, 0xFE]));
     18    const response = new Response(buffer, { headers: { "Content-Type": "application/wasm" } });
     19    return promise_rejects_js(t, WebAssembly.CompileError, WebAssembly[method](response));
     20  }, `Invalid code (0xCAFE): ${method}`);
     21 }