targetdesc-configurable-desc-not-configurable-realm.js (1086B)
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-defineownproperty-p-desc 5 description: > 6 Throw a TypeError exception if Desc is not configurable and target property 7 descriptor is configurable and trap result is true (honoring the realm of 8 the current execution context). 9 info: | 10 [[DefineOwnProperty]] (P, Desc) 11 12 ... 13 20. Else targetDesc is not undefined, 14 b. If settingConfigFalse is true and targetDesc.[[Configurable]] is 15 true, throw a TypeError exception. 16 ... 17 features: [cross-realm, Proxy] 18 ---*/ 19 20 var OProxy = $262.createRealm().global.Proxy; 21 var target = Object.create(null); 22 var p = new OProxy(target, { 23 defineProperty: function() { 24 return true; 25 } 26 }); 27 28 Object.defineProperty(target, 'prop', { 29 value: 1, 30 configurable: true 31 }); 32 33 assert.throws(TypeError, function() { 34 Object.defineProperty(p, 'prop', { 35 value: 1, 36 configurable: false 37 }); 38 }); 39 40 reportCompare(0, 0);