tor-browser

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

invoke-resolve-get-error-reject.js (1077B)


      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: >
      7  Error retrieving the constructor's `resolve` method (rejecting promise)
      8 esid: sec-promise.allsettled
      9 info: |
     10  6. Let result be PerformPromiseAllSettled(iteratorRecord, C, promiseCapability).
     11  7. If result is an abrupt completion, then
     12    a. If iteratorRecord.[[Done]] is false, set result to IteratorClose(iteratorRecord, result).
     13    b. IfAbruptRejectPromise(result, promiseCapability).
     14 
     15  Runtime Semantics: PerformPromiseAllSettled
     16 
     17  6. Repeat
     18    ...
     19    i. Let nextPromise be ? Invoke(constructor, "resolve", « nextValue »).
     20 flags: [async]
     21 features: [Promise.allSettled]
     22 ---*/
     23 
     24 var error = new Test262Error();
     25 Object.defineProperty(Promise, 'resolve', {
     26  get() {
     27    throw error;
     28  }
     29 });
     30 
     31 Promise.allSettled([new Promise(function() {})]).then(function() {
     32  throw new Test262Error('The promise should be rejected');
     33 }, function(reason) {
     34  assert.sameValue(reason, error);
     35 }).then($DONE, $DONE);