tor-browser

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

is-a-constructor.js (1018B)


      1 // Copyright (C) 2020 Rick Waldron. All rights reserved.
      2 // This code is governed by the BSD license found in the LICENSE file.
      3 
      4 /*---
      5 esid: sec-ecmascript-standard-built-in-objects
      6 description: >
      7  BigInt is a constructor, and does implement [[Construct]], but is not new target
      8 info: |
      9  sec-bigint-constructor
     10 
     11  - is not intended to be used with the new operator or to be subclassed. It may be used as the value of an extends clause of a class definition but a super call to the BigInt constructor will cause an exception.
     12 
     13  sec-bigint-constructor-number-value
     14 
     15  1. If NewTarget is not undefined, throw a TypeError exception.
     16 includes: [isConstructor.js]
     17 features: [BigInt, Reflect.construct, arrow-function]
     18 ---*/
     19 
     20 assert.sameValue(
     21  isConstructor(BigInt),
     22  true,
     23  'isConstructor(BigInt) must return true'
     24 );
     25 
     26 assert.throws(TypeError, () => {
     27  new BigInt({
     28    valueOf() {
     29      new Test262Error();
     30    }
     31  });
     32 }, '`new BigInt({ valueOf() {new Test262Error();}})` throws TypeError');
     33 
     34 
     35 reportCompare(0, 0);