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