result-is-undefined-targetdesc-is-not-configurable.js (824B)
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 not configurable 8 info: | 9 [[GetOwnProperty]] (P) 10 11 ... 12 14. If trapResultObj is undefined, then 13 ... 14 b. If targetDesc.[[Configurable]] is false, throw a TypeError exception. 15 ... 16 features: [Proxy] 17 ---*/ 18 19 var target = {}; 20 Object.defineProperty(target, "foo", { 21 configurable: false, 22 enumerable: false, 23 value: 1 24 }); 25 26 var p = new Proxy(target, { 27 getOwnPropertyDescriptor: function(t, prop) { 28 return; 29 } 30 }); 31 32 assert.throws(TypeError, function() { 33 Object.getOwnPropertyDescriptor(p, "foo"); 34 }); 35 36 reportCompare(0, 0);