| 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.6 |
| 5 |
description: > |
| 6 |
Throw a TypeError exception if Desc is not configurable and target is not |
| 7 |
extensible, and trap result is true. |
| 8 |
info: | |
| 9 |
[[DefineOwnProperty]] (P, Desc) |
| 10 |
|
| 11 |
... |
| 12 |
19. If targetDesc is undefined, then |
| 13 |
a. If extensibleTarget is false, throw a TypeError exception. |
| 14 |
... |
| 15 |
---*/ |
| 16 |
|
| 17 |
var target = {}; |
| 18 |
var p = new Proxy(target, { |
| 19 |
defineProperty: function(t, prop, desc) { |
| 20 |
return true; |
| 21 |
} |
| 22 |
}); |
| 23 |
|
| 24 |
Object.preventExtensions(target); |
| 25 |
|
| 26 |
assert.throws(TypeError, function() { |
| 27 |
Object.defineProperty(p, "foo", {}); |
| 28 |
}); |