| 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 trap is not callable. |
| 7 |
info: | |
| 8 |
[[DefineOwnProperty]] (P, Desc) |
| 9 |
|
| 10 |
... |
| 11 |
6. Let trap be GetMethod(handler, "defineProperty"). |
| 12 |
... |
| 13 |
7.3.9 GetMethod (O, P) |
| 14 |
... |
| 15 |
2. Let func be GetV(O, P). |
| 16 |
5. If IsCallable(func) is false, throw a TypeError exception. |
| 17 |
... |
| 18 |
---*/ |
| 19 |
|
| 20 |
var target = {}; |
| 21 |
var p = new Proxy(target, { |
| 22 |
defineProperty: {} |
| 23 |
}); |
| 24 |
|
| 25 |
assert.throws(TypeError, function() { |
| 26 |
Object.defineProperty(p, "foo", { |
| 27 |
value: 1 |
| 28 |
}); |
| 29 |
}); |