tor-browser

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

create-resolving-functions-resolve.js (1042B)


      1 // |reftest| async
      2 // Copyright (C) 2019 Alexey Shvayka. All rights reserved.
      3 // This code is governed by the BSD license found in the LICENSE file.
      4 /*---
      5 esid: sec-createresolvingfunctions
      6 description: >
      7  resolve is anonymous built-in function with length of 1.
      8 info: |
      9  CreateResolvingFunctions ( promise )
     10 
     11  ...
     12  3. Let resolve be ! CreateBuiltinFunction(stepsResolve, « [[Promise]], [[AlreadyResolved]] »).
     13 features: [Reflect.construct, arrow-function]
     14 includes: [isConstructor.js]
     15 flags: [async]
     16 ---*/
     17 
     18 Promise.resolve(1).then(function() {
     19  return Promise.resolve();
     20 }).then($DONE, $DONE);
     21 
     22 var then = Promise.prototype.then;
     23 Promise.prototype.then = function(resolve, reject) {
     24  assert.sameValue(isConstructor(resolve), false, 'isConstructor(resolve) must return false');
     25  assert.throws(TypeError, () => {
     26    new resolve();
     27  });
     28 
     29  assert.sameValue(resolve.length, 1, 'The value of resolve.length is 1');
     30  assert.sameValue(resolve.name, '', 'The value of resolve.name is ""');
     31 
     32  return then.call(this, resolve, reject);
     33 };