diff -r 000000000000 -r 6474c204b198 js/src/jit-test/tests/collections/iterator-proto-1.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/js/src/jit-test/tests/collections/iterator-proto-1.js Wed Dec 31 06:09:35 2014 +0100 @@ -0,0 +1,15 @@ +// All iterators of the same collection type share their immediate prototype. +// Those prototype objects in turn inherit directly from Iterator.prototype. + +load(libdir + "iteration.js"); + +function test(obj0, obj1) { + var iter0 = obj0[std_iterator](), iter1 = obj1[std_iterator](); + var proto = Object.getPrototypeOf(iter0); + assertEq(Object.getPrototypeOf(iter1), proto); + assertEq(Object.getPrototypeOf(proto), Iterator.prototype); +} + +test([], [1]); +test(Map(), Map([[1, 1]])); +test(Set(), Set([1]));