| 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 not configurable but target |
| 7 |
property descriptor is configurable. |
| 8 |
info: | |
| 9 |
[[GetOwnProperty]] (P) |
| 10 |
|
| 11 |
... |
| 12 |
22. If resultDesc.[[Configurable]] is false, then |
| 13 |
a. If targetDesc is undefined or targetDesc.[[Configurable]] is true, |
| 14 |
then |
| 15 |
i. Throw a TypeError exception. |
| 16 |
... |
| 17 |
---*/ |
| 18 |
|
| 19 |
var target = { |
| 20 |
bar: 1 |
| 21 |
}; |
| 22 |
|
| 23 |
var p = new Proxy(target, { |
| 24 |
getOwnPropertyDescriptor: function(t, prop) { |
| 25 |
var foo = {}; |
| 26 |
|
| 27 |
Object.defineProperty(foo, "bar", { |
| 28 |
configurable: false, |
| 29 |
enumerable: true, |
| 30 |
value: 1 |
| 31 |
}); |
| 32 |
|
| 33 |
return Object.getOwnPropertyDescriptor(foo, prop); |
| 34 |
} |
| 35 |
}); |
| 36 |
|
| 37 |
assert.throws(TypeError, function() { |
| 38 |
Object.getOwnPropertyDescriptor(p, "bar"); |
| 39 |
}); |