js/src/tests/ecma_6/Proxy/proxy-constructNonObject.js

branch
TOR_BUG_3246
changeset 7
129ffea94266
equal deleted inserted replaced
-1:000000000000 0:4e81692ee3b2
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");

mercurial