tor-browser

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

invoke-resolve-error-reject.js (1095B)


      1 // |reftest| async
      2 // Copyright (C) 2019 Leo Balter. All rights reserved.
      3 // This code is governed by the BSD license found in the LICENSE file.
      4 
      5 /*---
      6 description: Promise rejection in response to error
      7 esid: sec-promise.allsettled
      8 info: |
      9  6. Let result be PerformPromiseAllSettled(iteratorRecord, C, promiseCapability).
     10  7. If result is an abrupt completion, then
     11    a. If iteratorRecord.[[Done]] is false, set result to IteratorClose(iteratorRecord, result).
     12    b. IfAbruptRejectPromise(result, promiseCapability).
     13 
     14  Runtime Semantics: PerformPromiseAllSettled
     15 
     16  6. Repeat
     17    ...
     18    i. Let nextPromise be ? Invoke(constructor, "resolve", « nextValue »).
     19 flags: [async]
     20 features: [Promise.allSettled]
     21 ---*/
     22 
     23 var thrown = new Test262Error();
     24 Promise.resolve = function() {
     25  throw thrown;
     26 };
     27 
     28 Promise.allSettled([1])
     29  .then(function() {
     30    throw new Test262Error('The promise should not be fulfilled.');
     31  }, function(reason) {
     32    if (reason !== thrown) {
     33      throw new Test262Error('The promise should be rejected with the thrown error object');
     34    }
     35  }).then($DONE, $DONE);