diff -r 000000000000 -r 6474c204b198 js/src/jit-test/tests/basic/testProxyConstructors.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/js/src/jit-test/tests/basic/testProxyConstructors.js Wed Dec 31 06:09:35 2014 +0100 @@ -0,0 +1,25 @@ +// |jit-test| error: ExitCleanly + +assertEq((new (Proxy.createFunction({}, + function(){ this.x = 1 }, + function(){ this.x = 2 }))).x, 2); +try { + x = Proxy.createFunction((function () {}), Uint16Array, wrap) + new(wrap(x)) + throw "Should not be reached" +} +catch (e) { + assertEq(String(e.message).indexOf('is not a constructor') === -1, false); +} +// proxies can return the callee +var x = Proxy.createFunction({}, function (q) { return q; }); +assertEq(new x(x), x); +try { + var x = (Proxy.createFunction({}, "".indexOf)); + new x; + throw "Should not be reached" +} +catch (e) { + assertEq(String(e.message).indexOf('is not a constructor') === -1, false); +} +throw "ExitCleanly"