tor-browser

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

backtrace.js (602B)


      1 var code = `(module
      2  (import "env" "test" (func $i))
      3  (func $t (call $i))
      4  (export "test" (func $t))
      5 )`;
      6 var mod = wasmEvalText(code, {
      7  env: {
      8    test: function() {
      9       // Expecting 3 lines in the backtrace (plus last empty).
     10       // The middle one is for the wasm function.
     11       var s = getBacktrace();
     12       var frames = s.split('\n');
     13       assertEq(frames.length, 4);
     14       assertEq(/> WebAssembly.Module":wasm-function\[1\]:0x/.test(frames[1]), true);
     15 
     16       // Let's also run DumpBacktrace() to check if we are not crashing.
     17       backtrace();
     18    }
     19  }
     20 }).exports;
     21 mod.test();