tor-browser

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

bug1330339.js (822B)


      1 // |jit-test| test-also=--wasm-compiler=optimizing; error: TestComplete
      2 
      3 if (!wasmDebuggingEnabled())
      4     throw "TestComplete";
      5 
      6 let module = new WebAssembly.Module(wasmTextToBinary(`
      7    (module
      8        (import "global" "func" (func))
      9        (func (export "test")
     10         call 0 ;; calls the import, which is func #0
     11        )
     12    )
     13 `));
     14 
     15 let imports = {
     16  global: {
     17    func: function () {
     18        let g = newGlobal({newCompartment: true});
     19        let dbg = new Debugger(g);
     20        dbg.onExceptionUnwind = function (frame) {
     21            frame.older;
     22        };
     23        g.eval("throw new Error();");
     24    }
     25  }
     26 };
     27 let instance = new WebAssembly.Instance(module, imports);
     28 
     29 try {
     30    instance.exports.test();
     31    assertEq(false, true);
     32 } catch (e) {
     33    assertEq(e.constructor.name, 'Error');
     34 }
     35 
     36 throw "TestComplete";