Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
1 // map.iterator() and iter.next() are non-generic but work on cross-compartment wrappers.
3 load(libdir + "asserts.js");
4 load(libdir + "iteration.js");
6 var g = newGlobal();
8 var iterator_fn = Set.prototype[std_iterator];
9 assertThrowsInstanceOf(function () { iterator_fn.call({}); }, TypeError);
10 assertThrowsInstanceOf(function () { iterator_fn.call(Map()); }, TypeError);
11 var setw = g.eval("Set(['x', 'y'])");
12 assertIteratorNext(iterator_fn.call(setw), "x");
14 var next_fn = Set()[std_iterator]().next;
15 assertThrowsInstanceOf(function () { next_fn.call({}); }, TypeError);
16 assertThrowsInstanceOf(function () { next_fn.call(Map()[std_iterator]()); }, TypeError);
17 var iterw = setw[std_iterator]();
18 assertIteratorResult(next_fn.call(iterw), "x", false);
19 assertIteratorResult(next_fn.call(iterw), "y", false);
20 assertIteratorResult(next_fn.call(iterw), undefined, true);