get-symbol-to-prim-err.js (971B)
1 // Copyright (C) 2015 the V8 project authors. All rights reserved. 2 // This code is governed by the BSD license found in the LICENSE file. 3 /*--- 4 es6id: 12.10.3 5 description: > 6 Behavior when error thrown while accessing `Symbol.toPrimitive` property 7 info: | 8 [...] 9 7. Return the result of performing Abstract Equality Comparison rval == 10 lval. 11 12 ES6 Section 7.2.12 Abstract Equality Comparison 13 14 [...] 15 10. If Type(x) is either String, Number, or Symbol and Type(y) is Object, 16 then return the result of the comparison x == ToPrimitive(y). 17 18 ES6 Section 7.1.1 ToPrimitive ( input [, PreferredType] ) 19 20 [...] 21 4. Let exoticToPrim be GetMethod(input, @@toPrimitive). 22 5. ReturnIfAbrupt(exoticToPrim). 23 features: [Symbol.toPrimitive] 24 ---*/ 25 26 var y = Object.defineProperty({}, Symbol.toPrimitive, { 27 get: function() { 28 throw new Test262Error(); 29 } 30 }); 31 32 assert.throws(Test262Error, function() { 33 0 == y; 34 }); 35 36 reportCompare(0, 0);