tor-browser

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

resolve-ignored-via-fn-deferred.js (1139B)


      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    Rejected promises ignore resolution after deferred invocation of the
      7    provided reject function
      8 esid: sec-promise-executor
      9 info: |
     10    [...]
     11    9. Let completion be Call(executor, undefined,
     12       «resolvingFunctions.[[Resolve]], resolvingFunctions.[[Reject]]»).
     13    10. If completion is an abrupt completion, then
     14        [...]
     15    11. Return promise.
     16 
     17    25.4.1.3.2 Promise Resolve Functions
     18 
     19    [...]
     20    3. Let alreadyResolved be F.[[AlreadyResolved]].
     21    4. If alreadyResolved.[[Value]] is true, return undefined.
     22 flags: [async]
     23 ---*/
     24 
     25 var returnValue = null;
     26 var thenable = new Promise(function() {});
     27 var resolve, reject;
     28 var p = new Promise(function(_resolve, _reject) {
     29  resolve = _resolve;
     30  reject = _reject;
     31 });
     32 
     33 p.then(function() {
     34  $DONE('The promise should not be fulfilled.');
     35 }, function() {
     36  $DONE();
     37 });
     38 
     39 reject(thenable);
     40 returnValue = resolve();
     41 
     42 assert.sameValue(returnValue, undefined, '"resolve" function return value');