|
1 function bogusConstruct(target) { return 4; } |
|
2 function bogusConstructUndefined(target) { } |
|
3 |
|
4 var handler = { construct: bogusConstruct } |
|
5 |
|
6 function callable() {} |
|
7 |
|
8 var p = new Proxy(callable, handler); |
|
9 |
|
10 assertThrowsInstanceOf(function () { new p(); }, TypeError, |
|
11 "[[Construct must throw if an object is not returned."); |
|
12 |
|
13 handler.construct = bogusConstructUndefined; |
|
14 assertThrowsInstanceOf(function () { new p(); }, TypeError, |
|
15 "[[Construct must throw if an object is not returned."); |
|
16 |
|
17 if (typeof reportCompare === "function") |
|
18 reportCompare(0,0, "OK"); |