tor-browser

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

executor-function-not-a-constructor.js (1134B)


      1 // Copyright (C) 2015 André Bargull. All rights reserved.
      2 // This code is governed by the BSD license found in the LICENSE file.
      3 
      4 /*---
      5 esid: sec-getcapabilitiesexecutor-functions
      6 description: GetCapabilitiesExecutor function is not constructor
      7 info: |
      8  17 ECMAScript Standard Built-in Objects:
      9    Built-in function objects that are not identified as constructors do not
     10    implement the [[Construct]] internal method unless otherwise specified
     11    in the description of a particular function.
     12 includes: [isConstructor.js]
     13 features: [Reflect.construct, arrow-function]
     14 ---*/
     15 
     16 var executorFunction;
     17 
     18 function NotPromise(executor) {
     19  executorFunction = executor;
     20  executor(function() {}, function() {});
     21 }
     22 Promise.resolve.call(NotPromise);
     23 
     24 assert.sameValue(
     25  Object.prototype.hasOwnProperty.call(executorFunction, "prototype"),
     26  false,
     27  'Object.prototype.hasOwnProperty.call(executorFunction, "prototype") must return false'
     28 );
     29 assert.sameValue(isConstructor(executorFunction), false, 'isConstructor(executorFunction) must return false');
     30 
     31 assert.throws(TypeError, () => {
     32  new executorFunction();
     33 });
     34 
     35 
     36 reportCompare(0, 0);