tor-browser

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

allSettled-array-mutation-2.js (511B)


      1 let called = 0;
      2 let fulfillFunction;
      3 let rejectFunction;
      4 class CustomPromise {
      5  constructor(executor) {
      6    executor(changeArray, changeArray);
      7  }
      8  static resolve() {
      9    return {
     10      then: (fulfill, reject) => {
     11        fulfillFunction = fulfill;
     12        rejectFunction = reject;
     13      }
     14    };
     15  }
     16 };
     17 function changeArray(result) {
     18  called++;
     19  assertEq(result.length, 1);
     20  result[0] = undefined;
     21 }
     22 Promise.allSettled.call(CustomPromise, [0]);
     23 rejectFunction();
     24 fulfillFunction();
     25 assertEq(called, 1);