tor-browser

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

ecma262-issue-1461.js (712B)


      1 // <https://github.com/tc39/ecma262/pull/1470> changes a detail of
      2 // error-handling in %AsyncFromSyncIteratorPrototype% methods. This test is
      3 // based on a comment in the thread where the issue was first reported,
      4 // <https://github.com/tc39/ecma262/issues/1461#issuecomment-468602852>
      5 
      6 let log = [];
      7 
      8 {
      9  async function f() {
     10    var p = Promise.resolve(0);
     11    Object.defineProperty(p, "constructor", {get() { throw "hi" }});
     12    for await (var x of [p]);
     13  }
     14  Promise.resolve(0)
     15         .then(() => log.push("tick 1"))
     16         .then(() => log.push("tick 2"))
     17         .then(() => log.push("tick 3"));
     18  f().catch(exc => log.push(exc));
     19 }
     20 
     21 drainJobQueue();
     22 assertEq(log.join(), "tick 1,tick 2,hi,tick 3");