tor-browser

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

reject-ignored-immed.js (1277B)


      1 // |reftest| async
      2 // Copyright (C) 2016 the V8 project authors. All rights reserved.
      3 // This code is governed by the BSD license found in the LICENSE file.
      4 /*---
      5 description: >
      6    Resolved promises ignore rejections through immediate invocation of the
      7    provided resolving function
      8 es6id: 25.4.4.1
      9 info: |
     10    [...]
     11    6. Let promiseCapability be NewPromiseCapability(C).
     12    [...]
     13    11. Let result be PerformPromiseAll(iteratorRecord, promiseCapability, C).
     14    [...]
     15 
     16    25.4.4.1.1 Runtime Semantics: PerformPromiseAll
     17    [...]
     18    6. Repeat
     19       [...]
     20       r. Let result be Invoke(nextPromise, "then", resolveElement,
     21          promiseCapability.[[Reject]]ยป).
     22 
     23    25.4.1.3.1 Promise Reject Functions
     24    [...]
     25    2. Let promise be the value of F's [[Promise]] internal slot.
     26    3. Let alreadyResolved be the value of F's [[AlreadyResolved]] internal
     27       slot.
     28    4. If alreadyResolved.[[value]] is true, return undefined.
     29 flags: [async]
     30 ---*/
     31 
     32 var fulfiller = {
     33  then: function(resolve) {
     34    resolve();
     35  }
     36 };
     37 var lateRejector = {
     38  then: function(resolve, reject) {
     39    resolve();
     40    reject();
     41  }
     42 };
     43 
     44 Promise.all([fulfiller, lateRejector])
     45  .then(function() {
     46    $DONE();
     47  }, function() {
     48    $DONE('The promise should not be rejected.');
     49  });