tor-browser

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

bug1330489-sps.js (1220B)


      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 // Single-step profiling currently only works in the ARM/ARM64 simulators
      9 if (!getBuildConfiguration("arm-simulator") && !getBuildConfiguration("arm64-simulator"))
     10    throw "TestComplete";
     11 
     12 enableGeckoProfiling();
     13 enableSingleStepProfiling();
     14 
     15 var g = newGlobal({newCompartment: true});
     16 g.parent = this;
     17 g.eval("Debugger(parent).onExceptionUnwind = function () {};");
     18 
     19 let module = new WebAssembly.Module(wasmTextToBinary(`
     20    (module
     21        (import "a" "b" (func $imp (result i32)))
     22        (memory 1 1)
     23        (table 2 2 funcref)
     24        (elem (i32.const 0) $imp $def)
     25        (func $def (result i32) (i32.load (i32.const 0)))
     26        (type $v2i (func (result i32)))
     27        (func $call (param i32) (result i32) (call_indirect (type $v2i) (local.get 0)))
     28        (export "call" (func $call))
     29    )
     30 `));
     31 
     32 let instance = new WebAssembly.Instance(module, {
     33    a: { b: function () { throw "test"; } }
     34 });
     35 
     36 try {
     37    instance.exports.call(0);
     38    assertEq(false, true);
     39 } catch (e) {
     40    assertEq(e, "test");
     41 }
     42 
     43 disableGeckoProfiling();
     44 throw "TestComplete";