tor-browser

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

weakRef_in_promise.js (403B)


      1 // https://github.com/tc39/proposal-weakrefs/issues/39
      2 // Weakref should keep the target until the end of current Job, that includes
      3 // microtask(Promise).
      4 let wr;
      5 {
      6  let obj = {};
      7  wr = new WeakRef(obj);
      8  obj = null;
      9 }
     10 // obj is out of block scope now, should be GCed.
     11 
     12 gc();
     13 
     14 assertEq(undefined == wr.deref(), false);
     15 Promise.resolve().then(() => {
     16  assertEq(undefined == wr.deref(), false);
     17 });