tor-browser

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

self-hosted.js (658B)


      1 // Test that we can save stacks with self-hosted function frames in them.
      2 
      3 const map = (function () {
      4  return [3].map(n => saveStack()).pop();
      5 }());
      6 
      7 assertEq(map.parent.functionDisplayName, "map");
      8 assertEq(map.parent.source, "self-hosted");
      9 
     10 const reduce = (function () {
     11  return [3].reduce(() => saveStack(), 3);
     12 }());
     13 
     14 assertEq(reduce.parent.functionDisplayName, "reduce");
     15 assertEq(reduce.parent.source, "self-hosted");
     16 
     17 const forEach = (function () {
     18  try {
     19    [3].forEach(n => { throw saveStack() });
     20  } catch (s) {
     21    return s;
     22  }
     23 }());
     24 
     25 assertEq(forEach.parent.functionDisplayName, "forEach");
     26 assertEq(forEach.parent.source, "self-hosted");