michael@0: // |jit-test| error: ExitCleanly michael@0: michael@0: assertEq((new (Proxy.createFunction({}, michael@0: function(){ this.x = 1 }, michael@0: function(){ this.x = 2 }))).x, 2); michael@0: try { michael@0: x = Proxy.createFunction((function () {}), Uint16Array, wrap) michael@0: new(wrap(x)) michael@0: throw "Should not be reached" michael@0: } michael@0: catch (e) { michael@0: assertEq(String(e.message).indexOf('is not a constructor') === -1, false); michael@0: } michael@0: // proxies can return the callee michael@0: var x = Proxy.createFunction({}, function (q) { return q; }); michael@0: assertEq(new x(x), x); michael@0: try { michael@0: var x = (Proxy.createFunction({}, "".indexOf)); michael@0: new x; michael@0: throw "Should not be reached" michael@0: } michael@0: catch (e) { michael@0: assertEq(String(e.message).indexOf('is not a constructor') === -1, false); michael@0: } michael@0: throw "ExitCleanly"