tor-browser

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

get-set.js (461B)


      1 // Test that we can save stacks with getter and setter function frames.
      2 
      3 function assertStackLengthEq(stack, expectedLength) {
      4  let actual = 0;
      5  while (stack) {
      6    actual++;
      7    stack = stack.parent;
      8  }
      9  assertEq(actual, expectedLength);
     10 }
     11 
     12 const get = { get s() { return saveStack(); } }.s;
     13 assertStackLengthEq(get, 2);
     14 
     15 let set;
     16 try {
     17  ({
     18    set s(v) {
     19      throw saveStack();
     20    }
     21  }).s = 1;
     22 } catch (s) {
     23  set = s;
     24 }
     25 assertStackLengthEq(set, 2);