tor-browser

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

caching-and-frame-count.js (1140B)


      1 // |jit-test| skip-if: getBuildConfiguration("wasi")
      2 //
      3 // Test that the SavedFrame caching doesn't mess up counts. Specifically, that
      4 // if we capture only the first n frames of a stack, we don't cache that stack
      5 // and return it for when someone else captures another stack and asks for more
      6 // frames than that last time.
      7 
      8 function stackLength(stack) {
      9  return stack === null
     10    ? 0
     11    : 1 + stackLength(stack.parent);
     12 }
     13 
     14 (function f0() {
     15  (function f1() {
     16    (function f2() {
     17      (function f3() {
     18        (function f4() {
     19          (function f5() {
     20            (function f6() {
     21              (function f7() {
     22                (function f8() {
     23                  (function f9() {
     24                    const s1 = saveStack(3);
     25                    const s2 = saveStack(5);
     26                    const s3 = saveStack(0 /* no limit */);
     27 
     28                    assertEq(stackLength(s1), 3);
     29                    assertEq(stackLength(s2), 5);
     30                    assertEq(stackLength(s3), 11);
     31                  }());
     32                }());
     33              }());
     34            }());
     35          }());
     36        }());
     37      }());
     38    }());
     39  }());
     40 }());