| 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.15 |
| 5 |
description: > |
| 6 |
A Proxy exotic object only accepts a constructor call if target is |
| 7 |
constructor. |
| 8 |
info: | |
| 9 |
Proxy ( target, handler ) |
| 10 |
|
| 11 |
7. If IsCallable(target) is true, then |
| 12 |
b. If target has a [[Construct]] internal method, then |
| 13 |
i. Set the [[Construct]] internal method of P as specified in |
| 14 |
9.5.14. |
| 15 |
... |
| 16 |
|
| 17 |
12.3.3.1.1 Runtime Semantics: EvaluateNew(constructProduction, arguments) |
| 18 |
|
| 19 |
8. If IsConstructor (constructor) is false, throw a TypeError exception. |
| 20 |
---*/ |
| 21 |
|
| 22 |
var p = new Proxy(eval, {}); |
| 23 |
|
| 24 |
p(); // the Proxy object is callable |
| 25 |
|
| 26 |
assert.throws(TypeError, function() { |
| 27 |
new p(); |
| 28 |
}); |