tor-browser

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

value-get-symbol-to-prim-err.js (881B)


      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: >
      6    Behavior when error thrown while accessing `Symbol.toPrimitive` property
      7 info: |
      8  [...]
      9  3. If NewTarget is not undefined, then
     10     a. If Type(value) is Object and value has a [[DateValue]] internal slot,
     11        then
     12        [...]
     13     b. Else,
     14        i. Let v be ? ToPrimitive(value).
     15 
     16    ES6 Section 7.1.1 ToPrimitive ( input [, PreferredType] )
     17 
     18    [...]
     19    4. Let exoticToPrim be GetMethod(input, @@toPrimitive).
     20    5. ReturnIfAbrupt(exoticToPrim).
     21 features: [Symbol.toPrimitive]
     22 ---*/
     23 
     24 var y = Object.defineProperty({}, Symbol.toPrimitive, {
     25  get: function() {
     26    throw new Test262Error();
     27  }
     28 });
     29 
     30 assert.throws(Test262Error, function() {
     31  new Date(y);
     32 });
     33 
     34 reportCompare(0, 0);