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.
michael@0 | 1 | function my_iterator_next() { |
michael@0 | 2 | if (this.i == 10) { |
michael@0 | 3 | this.i = 0; |
michael@0 | 4 | throw this.StopIteration; |
michael@0 | 5 | } |
michael@0 | 6 | return this.i++; |
michael@0 | 7 | } |
michael@0 | 8 | function testCustomIterator() { |
michael@0 | 9 | var o = { |
michael@0 | 10 | __iterator__: function () { |
michael@0 | 11 | return { |
michael@0 | 12 | i: 0, |
michael@0 | 13 | next: my_iterator_next, |
michael@0 | 14 | StopIteration: StopIteration |
michael@0 | 15 | }; |
michael@0 | 16 | } |
michael@0 | 17 | }; |
michael@0 | 18 | var a=[]; |
michael@0 | 19 | for (var k = 0; k < 100; k += 10) { |
michael@0 | 20 | for(var j in o) { |
michael@0 | 21 | a[k + (j >> 0)] = j*k; |
michael@0 | 22 | } |
michael@0 | 23 | } |
michael@0 | 24 | return a.join(); |
michael@0 | 25 | } |
michael@0 | 26 | assertEq(testCustomIterator(), "0,0,0,0,0,0,0,0,0,0,0,10,20,30,40,50,60,70,80,90,0,20,40,60,80,100,120,140,160,180,0,30,60,90,120,150,180,210,240,270,0,40,80,120,160,200,240,280,320,360,0,50,100,150,200,250,300,350,400,450,0,60,120,180,240,300,360,420,480,540,0,70,140,210,280,350,420,490,560,630,0,80,160,240,320,400,480,560,640,720,0,90,180,270,360,450,540,630,720,810"); |