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.
1 // Test that yield* can appear in a loop, and alongside yield.
3 function* countdown(n) {
4 while (n > 0) {
5 yield n;
6 yield* countdown(--n);
7 }
8 return 34;
9 }
11 function collect_results(iter) {
12 var ret = [];
13 var result;
14 do {
15 result = iter.next();
16 ret.push(result);
17 } while (!result.done);
18 return ret;
19 }
21 var expected = [
22 // yield in countdown(3), n == 3
23 {value: 3, done: false},
24 // yield in yield* countdown(2), n == 2
25 {value: 2, done: false},
26 // yield in nested yield* countdown(1), n == 1
27 {value: 1, done: false},
28 // countdown(0) yields no values
29 // second go-through of countdown(2) loop, n == 1
30 {value: 1, done: false},
31 // second go-through of countdown(3) loop, n == 2
32 {value: 2, done: false},
33 // yield in yield* countdown(1), n == 1
34 {value: 1, done: false},
35 // third go-through of countdown(3) loop, n == 1
36 {value: 1, done: false},
37 // done
38 {value: 34, done: true}
39 ];
41 assertDeepEq(expected, collect_results(countdown(3)));
43 if (typeof reportCompare == "function")
44 reportCompare(true, true);