tor-browser

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

resolve-non-thenable.js (930B)


      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: Resolving with a non-thenable object value
      6 es6id: 25.4.4.5
      7 info: |
      8    [...]
      9    6. Let resolveResult be Call(promiseCapability.[[Resolve]], undefined,
     10       «x»).
     11    [...]
     12 
     13    25.4.1.3.2 Promise Resolve Functions
     14    [...]
     15    8. Let then be Get(resolution, "then").
     16    9. If then is an abrupt completion, then
     17       [...]
     18    10. Let thenAction be then.[[value]].
     19    11. If IsCallable(thenAction) is false, then
     20        a. Return FulfillPromise(promise, resolution).
     21 flags: [async]
     22 ---*/
     23 
     24 var value = {};
     25 
     26 Promise.resolve(value).then(function(value) {
     27  if (value !== value) {
     28    $DONE('The promise should be fulfilled with the provided value.');
     29    return;
     30  }
     31 
     32  $DONE();
     33 }, function() {
     34  $DONE('The promise should not be rejected.');
     35 });