michael@0: // for-of is defined in terms of basic operations on objects, particularly michael@0: // [[Get]] for properties named "iterator" and "next", and [[Call]]. These michael@0: // "semantics" tests check that for-of really does appear to be implemented in michael@0: // terms of those more basic operations, as required by the spec, even in michael@0: // unusual cases. michael@0: michael@0: // Deleting Array.prototype.iterator makes for-of stop working on arrays. michael@0: michael@0: load(libdir + "asserts.js"); michael@0: load(libdir + "iteration.js"); michael@0: michael@0: delete Array.prototype[std_iterator]; michael@0: assertThrowsInstanceOf(function () { for (var x of []) ; }, TypeError);