trap-is-not-callable-realm.js (753B)
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-proxy-object-internal-methods-and-internal-slots-ownpropertykeys 5 description: > 6 Throws if trap is not callable (honoring the Realm of the current execution 7 context) 8 info: | 9 [[OwnPropertyKeys]] ( ) 10 11 5. Let trap be GetMethod(handler, "ownKeys"). 12 ... 13 14 #sec-getmethod 15 7.3.9 GetMethod (O, P) 16 17 4. If IsCallable(func) is false, throw a TypeError exception. 18 features: [cross-realm, Proxy] 19 ---*/ 20 21 var OProxy = $262.createRealm().global.Proxy; 22 var p = new OProxy({ 23 attr: 1 24 }, { 25 ownKeys: {} 26 }); 27 28 assert.throws(TypeError, function() { 29 Object.keys(p); 30 }); 31 32 reportCompare(0, 0);