Sat, 03 Jan 2015 20:18:00 +0100
Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.
michael@0 | 1 | // Test that yield* can appear in a loop, and inside yield. |
michael@0 | 2 | |
michael@0 | 3 | function* countdown(n) { |
michael@0 | 4 | while (n > 0) { |
michael@0 | 5 | yield (yield* countdown(--n)); |
michael@0 | 6 | } |
michael@0 | 7 | return 34; |
michael@0 | 8 | } |
michael@0 | 9 | |
michael@0 | 10 | function collect_results(iter) { |
michael@0 | 11 | var ret = []; |
michael@0 | 12 | var result; |
michael@0 | 13 | do { |
michael@0 | 14 | result = iter.next(); |
michael@0 | 15 | ret.push(result); |
michael@0 | 16 | } while (!result.done); |
michael@0 | 17 | return ret; |
michael@0 | 18 | } |
michael@0 | 19 | |
michael@0 | 20 | var expected = [ |
michael@0 | 21 | // Only 34 yielded from the "yield" and the last return make it out. |
michael@0 | 22 | // Three yields in countdown(3), two in countdown(2), and one in |
michael@0 | 23 | // countdown(1) (called twice). |
michael@0 | 24 | {value: 34, done: false}, |
michael@0 | 25 | {value: 34, done: false}, |
michael@0 | 26 | {value: 34, done: false}, |
michael@0 | 27 | {value: 34, done: false}, |
michael@0 | 28 | {value: 34, done: false}, |
michael@0 | 29 | {value: 34, done: false}, |
michael@0 | 30 | {value: 34, done: false}, |
michael@0 | 31 | {value: 34, done: true}, // final |
michael@0 | 32 | ]; |
michael@0 | 33 | |
michael@0 | 34 | assertDeepEq(collect_results(countdown(3)), expected); |
michael@0 | 35 | |
michael@0 | 36 | if (typeof reportCompare == "function") |
michael@0 | 37 | reportCompare(true, true); |