tor-browser

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

revocation-function-not-a-constructor.js (1022B)


      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-proxy.revocable
      6 description: Proxy Revocation 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 includes: [isConstructor.js]
     13 features: [Proxy, Reflect.construct, arrow-function]
     14 ---*/
     15 
     16 var revocationFunction = Proxy.revocable({}, {}).revoke;
     17 
     18 assert.sameValue(
     19  Object.prototype.hasOwnProperty.call(revocationFunction, "prototype"),
     20  false,
     21  'Object.prototype.hasOwnProperty.call(revocationFunction, "prototype") must return false'
     22 );
     23 assert.sameValue(isConstructor(revocationFunction), false, 'isConstructor(revocationFunction) must return false');
     24 assert.throws(TypeError, () => {
     25  new revocationFunction();
     26 });
     27 
     28 
     29 
     30 reportCompare(0, 0);