1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/js/src/jit-test/tests/basic/testProxyConstructors.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,25 @@ 1.4 +// |jit-test| error: ExitCleanly 1.5 + 1.6 +assertEq((new (Proxy.createFunction({}, 1.7 + function(){ this.x = 1 }, 1.8 + function(){ this.x = 2 }))).x, 2); 1.9 +try { 1.10 + x = Proxy.createFunction((function () {}), Uint16Array, wrap) 1.11 + new(wrap(x)) 1.12 + throw "Should not be reached" 1.13 +} 1.14 +catch (e) { 1.15 + assertEq(String(e.message).indexOf('is not a constructor') === -1, false); 1.16 +} 1.17 +// proxies can return the callee 1.18 +var x = Proxy.createFunction({}, function (q) { return q; }); 1.19 +assertEq(new x(x), x); 1.20 +try { 1.21 + var x = (Proxy.createFunction({}, "".indexOf)); 1.22 + new x; 1.23 + throw "Should not be reached" 1.24 +} 1.25 +catch (e) { 1.26 + assertEq(String(e.message).indexOf('is not a constructor') === -1, false); 1.27 +} 1.28 +throw "ExitCleanly"