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 factorial(n) { |
michael@0 | 2 | if (n <= 1) { |
michael@0 | 3 | return 1; |
michael@0 | 4 | } else { |
michael@0 | 5 | return n * factorial(n - 1); |
michael@0 | 6 | } |
michael@0 | 7 | } |
michael@0 | 8 | |
michael@0 | 9 | function* yielder(n) { |
michael@0 | 10 | while (n-- >= 0) { |
michael@0 | 11 | yield { value: n, squared: n * n }; |
michael@0 | 12 | } |
michael@0 | 13 | } |
michael@0 | 14 | |
michael@0 | 15 | function thrower() { |
michael@0 | 16 | throw new Error("Curse your sudden but inevitable betrayal!"); |
michael@0 | 17 | } |
michael@0 | 18 | |
michael@0 | 19 | function main() { |
michael@0 | 20 | factorial(5); |
michael@0 | 21 | |
michael@0 | 22 | // XXX bug 923729: Can't test yielding yet. |
michael@0 | 23 | // for (let x of yielder(5)) {} |
michael@0 | 24 | |
michael@0 | 25 | try { |
michael@0 | 26 | thrower(); |
michael@0 | 27 | } catch (e) { |
michael@0 | 28 | } |
michael@0 | 29 | } |