| 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-preventextensions |
| 5 |
es6id: 9.5.4 |
| 6 |
description: > |
| 7 |
Throws if trap is not callable (honoring the Realm of the current execution |
| 8 |
context) |
| 9 |
info: | |
| 10 |
[[PreventExtensions]] ( ) |
| 11 |
|
| 12 |
... |
| 13 |
1. Let handler be the value of the [[ProxyHandler]] internal slot of O. |
| 14 |
... |
| 15 |
5. Let trap be GetMethod(handler, "preventExtensions"). |
| 16 |
... |
| 17 |
7.3.9 GetMethod (O, P) |
| 18 |
... |
| 19 |
2. Let func be GetV(O, P). |
| 20 |
5. If IsCallable(func) is false, throw a TypeError exception. |
| 21 |
... |
| 22 |
features: [cross-realm] |
| 23 |
---*/ |
| 24 |
|
| 25 |
var OProxy = $262.createRealm().global.Proxy; |
| 26 |
var p = new OProxy({}, { |
| 27 |
preventExtensions: {} |
| 28 |
}); |
| 29 |
|
| 30 |
assert.throws(TypeError, function() { |
| 31 |
Object.preventExtensions(p); |
| 32 |
}); |