michael@0: // Test createThisScripted(), without a singleton. michael@0: function Foo(a) { michael@0: this.str = "foo"; michael@0: } michael@0: michael@0: function Bar(a) { michael@0: this.str = "bar"; michael@0: } michael@0: michael@0: function f() { michael@0: var x; michael@0: for (var i = 0; i < 400; i++) { michael@0: if (i % 2 == 0) michael@0: x = Foo; michael@0: else michael@0: x = Bar; michael@0: michael@0: var y = new x(5); michael@0: michael@0: if (i % 2 == 0) michael@0: assertEq(y.str, "foo"); michael@0: else michael@0: assertEq(y.str, "bar"); michael@0: } michael@0: } michael@0: michael@0: f();