diff -r 000000000000 -r 6474c204b198 js/src/tests/ecma_6/Proxy/proxy-constructNonObject.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/js/src/tests/ecma_6/Proxy/proxy-constructNonObject.js Wed Dec 31 06:09:35 2014 +0100 @@ -0,0 +1,18 @@ +function bogusConstruct(target) { return 4; } +function bogusConstructUndefined(target) { } + +var handler = { construct: bogusConstruct } + +function callable() {} + +var p = new Proxy(callable, handler); + +assertThrowsInstanceOf(function () { new p(); }, TypeError, + "[[Construct must throw if an object is not returned."); + +handler.construct = bogusConstructUndefined; +assertThrowsInstanceOf(function () { new p(); }, TypeError, + "[[Construct must throw if an object is not returned."); + +if (typeof reportCompare === "function") + reportCompare(0,0, "OK");