tor-browser

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

resolve-non-obj-deferred.js (1079B)


      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    Resolving with a non-object value after invocation of the executor function
      7 es6id: 25.4.3.1
      8 info: |
      9    [...]
     10    8. Let resolvingFunctions be CreateResolvingFunctions(promise).
     11    9. Let completion be Call(executor, undefined,
     12       «resolvingFunctions.[[Resolve]], resolvingFunctions.[[Reject]]»).
     13 
     14    25.4.1.3.2 Promise Resolve Functions
     15    7. If Type(resolution) is not Object, then
     16       a. Return FulfillPromise(promise, resolution).
     17 flags: [async]
     18 ---*/
     19 
     20 var returnValue = null;
     21 var resolve;
     22 var promise = new Promise(function(_resolve) {
     23  resolve = _resolve;
     24 });
     25 
     26 promise.then(function(value) {
     27  if (value !== 45) {
     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 });
     36 
     37 returnValue = resolve(45);
     38 
     39 assert.sameValue(returnValue, undefined, '"resolve" return value');