tor-browser

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

reject-deferred.js (1065B)


      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: Rejecting through deferred invocation of the provided resolving function
      6 es6id: 25.4.4.1
      7 info: |
      8    [...]
      9    6. Let promiseCapability be NewPromiseCapability(C).
     10    [...]
     11    11. Let result be PerformPromiseAll(iteratorRecord, promiseCapability, C).
     12    [...]
     13 
     14    25.4.4.1.1 Runtime Semantics: PerformPromiseAll
     15    [...]
     16    6. Repeat
     17       [...]
     18       r. Let result be Invoke(nextPromise, "then", resolveElement,
     19          promiseCapability.[[Reject]]ยป).
     20 
     21    25.4.1.3.1 Promise Reject Functions
     22    [...]
     23    6. Return RejectPromise(promise, reason).
     24 flags: [async]
     25 ---*/
     26 
     27 var thenable = {
     28  then: function(_, reject) {
     29    new Promise(function(resolve) {
     30        resolve();
     31      })
     32      .then(function() {
     33        reject();
     34      });
     35  }
     36 };
     37 
     38 Promise.all([thenable])
     39  .then(function() {
     40    $DONE('The promise should not be fulfilled.');
     41  }, function(x) {
     42    $DONE();
     43  });