result-is-undefined-targetdesc-is-undefined.js (721B)
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: 9.5.5 5 description: > 6 Throws a TypeError exception if trap result is undefined and target property 7 descriptor is undefined. 8 info: | 9 [[GetOwnProperty]] (P) 10 11 ... 12 14. If trapResultObj is undefined, then 13 a. If targetDesc is undefined, return undefined. 14 ... 15 features: [Proxy] 16 ---*/ 17 18 var t = {}; 19 var trapped; 20 var p = new Proxy(t, { 21 getOwnPropertyDescriptor: function(target, prop) { 22 trapped = true; 23 return; 24 } 25 }); 26 27 assert.sameValue( 28 Object.getOwnPropertyDescriptor(p, "attr"), 29 undefined 30 ); 31 32 assert(trapped); 33 34 reportCompare(0, 0);