michael@0: // Replacing Array.prototype.iterator with something non-callable makes for-of throw. michael@0: michael@0: load(libdir + "asserts.js"); michael@0: load(libdir + "iteration.js"); michael@0: michael@0: function test(v) { michael@0: Array.prototype[std_iterator] = v; michael@0: assertThrowsInstanceOf(function () { for (var x of []) ; }, TypeError); michael@0: } michael@0: test(undefined); michael@0: test(null); michael@0: test({});