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