tor-browser

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

onNewScript-wasm-01.js (886B)


      1 // |jit-test| skip-if: !wasmDebuggingEnabled()
      2 // Draining the job queue from an onNewScript hook reporting a streamed wasm
      3 // module should not deadlock.
      4 
      5 ignoreUnhandledRejections();
      6 
      7 try {
      8    WebAssembly.compileStreaming();
      9    // Avoid mixing the test's jobs with the debuggee's, so that
     10    // automated checks can make sure AutoSaveJobQueue only
     11    // suspends debuggee work.
     12    drainJobQueue();
     13 } catch (err) {
     14    assertEq(String(err).indexOf("not supported with --no-threads") !== -1, true);
     15    quit();
     16 }
     17 
     18 load(libdir + "asserts.js");
     19 
     20 var g = newGlobal({newCompartment: true});
     21 
     22 var source = new g.Uint8Array(wasmTextToBinary('(module (func unreachable))'));
     23 g.source = source;
     24 
     25 var dbg = new Debugger(g);
     26 dbg.allowWasmBinarySource = true;
     27 dbg.onNewScript = function (s, g) {
     28    drainJobQueue();
     29 };
     30 
     31 g.eval('WebAssembly.instantiateStreaming(source);');
     32 
     33 drainJobQueue();