tor-browser

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

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


      1 // |reftest| async
      2 // Copyright (C) 2019 Leo Balter, 2020 Rick Waldron. 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.any
      8 info: |
      9  5. Let result be PerformPromiseAny(iteratorRecord, C, promiseCapability).
     10  6. 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: PerformPromiseAny
     15 
     16  8. Repeat
     17    ...
     18    i. Let nextPromise be ? Call(promiseResolve, constructor, « nextValue »).
     19 
     20 flags: [async]
     21 features: [Promise.any, arrow-function]
     22 ---*/
     23 
     24 let error = new Test262Error();
     25 Promise.resolve = function() {
     26  throw error;
     27 };
     28 
     29 Promise.any([1]).then(() => {
     30    $DONE('The promise should be rejected, but was resolved');
     31  }, (reason) => {
     32    assert.sameValue(reason, error);
     33  }).then($DONE, $DONE);