michael@0: // Test IC for getters backed by a JSNative. michael@0: function test1() { michael@0: for (var i = 0; i < 60; i++) { michael@0: assertEq(it.customNative, undefined); michael@0: } michael@0: michael@0: var res = 0; michael@0: for (var i = 0; i < 60; i++) { michael@0: it.customNative = i; michael@0: res += it.customNative; michael@0: } michael@0: michael@0: assertEq(res, 1770); michael@0: } michael@0: function test2() { michael@0: function getValue() { michael@0: return it.customNative; michael@0: } michael@0: michael@0: for (var i = 0; i < 60; i++) { michael@0: it.customNative = i; michael@0: assertEq(getValue(), i); michael@0: } michael@0: michael@0: for (var i = 0; i < 60; i++) { michael@0: it.customNative = null; michael@0: assertEq(getValue(), null); michael@0: michael@0: delete it["customNativ" + "e"]; michael@0: assertEq(getValue(), undefined); michael@0: assertEq(it.customNative, undefined); michael@0: } michael@0: } michael@0: if ("it" in this) { michael@0: test1(); michael@0: test2(); michael@0: }