desc-realm.js (948B)
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 Property descriptor object is created in the Realm of the current execution 7 context 8 info: | 9 [[DefineOwnProperty]] (P, Desc) 10 11 ... 12 8. Let descObj be FromPropertyDescriptor(Desc). 13 9. Let booleanTrapResult be ToBoolean(? Call(trap, handler, « target, P, 14 descObj »)). 15 ... 16 17 6.2.4.4 FromPropertyDescriptor 18 19 ... 20 2. Let obj be ObjectCreate(%ObjectPrototype%). 21 ... 22 11. Return obj. 23 features: [cross-realm, Proxy] 24 ---*/ 25 26 var OProxy = $262.createRealm().global.Proxy; 27 var desc; 28 var p = new OProxy({}, { 29 defineProperty: function(_, __, _desc) { 30 desc = _desc; 31 return desc; 32 } 33 }); 34 35 p.a = 0; 36 37 assert.sameValue(Object.getPrototypeOf(desc), Object.prototype); 38 39 reportCompare(0, 0);