tor-browser

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

resolve-function-nonconstructor.js (751B)


      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 es6id: 25.4.1.3.2
      6 description: Promise Resolve functions are not constructors
      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 ---*/
     13 
     14 var resolveFunction;
     15 new Promise(function(resolve, reject) {
     16  resolveFunction = resolve;
     17 });
     18 
     19 assert.sameValue(Object.prototype.hasOwnProperty.call(resolveFunction, "prototype"), false);
     20 assert.throws(TypeError, function() {
     21  new resolveFunction();
     22 });
     23 
     24 reportCompare(0, 0);