trap-is-not-callable-realm.js (1015B)
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-getownproperty-p 5 description: > 6 Throws if trap is not callable (honoring the Realm of the current execution 7 context) 8 info: | 9 [[GetOwnProperty]] (P) 10 11 ... 12 2. Let handler be the value of the [[ProxyHandler]] internal slot of O. 13 ... 14 5. Let target be the value of the [[ProxyTarget]] internal slot of O. 15 6. Let trap be GetMethod(handler, "getOwnPropertyDescriptor"). 16 ... 17 7.3.9 GetMethod (O, P) 18 ... 19 2. Let func be GetV(O, P). 20 5. If IsCallable(func) is false, throw a TypeError exception. 21 ... 22 features: [cross-realm, Proxy] 23 ---*/ 24 25 var OProxy = $262.createRealm().global.Proxy; 26 var p = new OProxy({}, { 27 getOwnPropertyDescriptor: {} 28 }); 29 30 assert.throws(TypeError, function() { 31 Object.getOwnPropertyDescriptor(p, "foo"); 32 }); 33 34 reportCompare(0, 0);