symbol-hasinstance-get-err.js (643B)
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 /*--- 5 es6id: 12.9.4 6 description: Error thrown when accessing constructor's @@hasInstance property 7 info: | 8 1. If Type(C) is not Object, throw a TypeError exception. 9 2. Let instOfHandler be GetMethod(C,@@hasInstance). 10 3. ReturnIfAbrupt(instOfHandler). 11 features: [Symbol.hasInstance] 12 ---*/ 13 14 var F = {}; 15 16 Object.defineProperty(F, Symbol.hasInstance, { 17 get: function() { 18 throw new Test262Error(); 19 } 20 }); 21 22 assert.throws(Test262Error, function() { 23 0 instanceof F; 24 }); 25 26 reportCompare(0, 0);