tor-browser

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

empty-body.any.js (800B)


      1 // META: global=window,worker
      2 
      3 const invalidArguments = [
      4  [() => new Response(undefined, { headers: { "Content-Type": "application/wasm" } }), "no body"],
      5  [() => new Response("", { headers: { "Content-Type": "application/wasm" } }), "empty body"],
      6 ];
      7 
      8 for (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 }