| 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 |
Throw a TypeError exception if Desc and target property descriptor are not |
| 8 |
compatible and trap result is true. |
| 9 |
info: | |
| 10 |
[[DefineOwnProperty]] (P, Desc) |
| 11 |
|
| 12 |
... |
| 13 |
20. Else targetDesc is not undefined, |
| 14 |
a. If IsCompatiblePropertyDescriptor(extensibleTarget, Desc , |
| 15 |
targetDesc) is false, throw a TypeError exception. |
| 16 |
... |
| 17 |
features: [cross-realm] |
| 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: false |
| 31 |
}); |
| 32 |
|
| 33 |
assert.throws(TypeError, function() { |
| 34 |
Object.defineProperty(p, 'prop', { |
| 35 |
value: 1, |
| 36 |
configurable: true |
| 37 |
}); |
| 38 |
}); |