tor-browser

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

toprimitive-call-abrupt.js (725B)


      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 /*---
      5 esid: sec-isnan-number
      6 description: >
      7  Return abrupt completion calling number.@@toPrimitive
      8 info: |
      9  isNaN (number)
     10 
     11  1. Let num be ? ToNumber(number).
     12 
     13  ToPrimitive ( input [ , PreferredType ] )
     14 
     15  [...]
     16  4. Let exoticToPrim be ? GetMethod(input, @@toPrimitive).
     17  5. If exoticToPrim is not undefined, then
     18    a. Let result be ? Call(exoticToPrim, input, « hint »).
     19 features: [Symbol.toPrimitive]
     20 ---*/
     21 
     22 var obj = {};
     23 obj[Symbol.toPrimitive] = function() {
     24  throw new Test262Error();
     25 };
     26 
     27 assert.throws(Test262Error, function() {
     28  isNaN(obj);
     29 });
     30 
     31 reportCompare(0, 0);