tor-browser

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

bug1330489.js (950B)


      1 // |jit-test| test-also=--wasm-compiler=optimizing; error: TestComplete
      2 
      3 load(libdir + "asserts.js");
      4 
      5 if (!wasmDebuggingEnabled())
      6    throw "TestComplete";
      7 
      8 var g = newGlobal({newCompartment: true});
      9 g.parent = this;
     10 g.eval("Debugger(parent).onExceptionUnwind = function () {};");
     11 
     12 let module = new WebAssembly.Module(wasmTextToBinary(`
     13    (module
     14        (import "a" "b" (func $imp (result i32)))
     15        (memory 1 1)
     16        (table 2 2 funcref)
     17        (elem (i32.const 0) $imp $def)
     18        (func $def (result i32) (i32.load (i32.const 0)))
     19        (type $v2i (func (result i32)))
     20        (func $call (param i32) (result i32) (call_indirect (type $v2i) (local.get 0)))
     21        (export "call" (func $call))
     22    )
     23 `));
     24 
     25 let instance = new WebAssembly.Instance(module, {
     26    a: { b: function () { throw "test"; } }
     27 });
     28 
     29 try {
     30    instance.exports.call(0);
     31    assertEq(false, true);
     32 } catch (e) {
     33    assertEq(e, "test");
     34 }
     35 
     36 throw "TestComplete";