toprimitive-get-abrupt.js (660B)
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-isfinite-number 6 description: > 7 Return abrupt completion getting number.@@toPrimitive 8 info: | 9 isFinite (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 features: [Symbol.toPrimitive] 18 ---*/ 19 20 var obj = Object.defineProperty({}, Symbol.toPrimitive, { 21 get: function() { 22 throw new Test262Error(); 23 } 24 }); 25 26 assert.throws(Test262Error, function() { 27 isFinite(obj); 28 }); 29 30 reportCompare(0, 0);