tor-browser

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

value-to-primitive-call-err.js (822B)


      1 // Copyright (C) 2016 the V8 project authors. All rights reserved.
      2 // This code is governed by the BSD license found in the LICENSE file.
      3 /*---
      4 esid: sec-date-value
      5 description: Error invoking `Symbol.toPrimitive` method of object value
      6 info: |
      7  3. If NewTarget is not undefined, then
      8     a. If Type(value) is Object and value has a [[DateValue]] internal slot, then
      9        i. Let tv be thisTimeValue(value).
     10     b. Else,
     11        i. Let v be ? ToPrimitive(value).
     12 
     13  ToPrimitive ( input [ , PreferredType ] )
     14 
     15  [...]
     16  4. Let exoticToPrim be ? GetMethod(input, @@toPrimitive).
     17 features: [Symbol.toPrimitive]
     18 ---*/
     19 
     20 var badToPrimitive = {};
     21 badToPrimitive[Symbol.toPrimitive] = function() {
     22  throw new Test262Error();
     23 };
     24 
     25 assert.throws(Test262Error, function() {
     26  new Date(badToPrimitive);
     27 });
     28 
     29 reportCompare(0, 0);