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 a deep yield* chain re-yields received results without |
michael@0 | 2 | // re-boxing. |
michael@0 | 3 | |
michael@0 | 4 | function results(results) { |
michael@0 | 5 | var i = 0; |
michael@0 | 6 | function next() { |
michael@0 | 7 | return results[i++]; |
michael@0 | 8 | } |
michael@0 | 9 | var iter = { next: next }; |
michael@0 | 10 | var ret = {}; |
michael@0 | 11 | ret[std_iterator] = function () { return iter; } |
michael@0 | 12 | return ret; |
michael@0 | 13 | } |
michael@0 | 14 | |
michael@0 | 15 | function* yield_results(expected, n) { |
michael@0 | 16 | return yield* n ? yield_results(expected, n - 1) : results(expected); |
michael@0 | 17 | } |
michael@0 | 18 | |
michael@0 | 19 | function collect_results(iterable) { |
michael@0 | 20 | var ret = []; |
michael@0 | 21 | var result; |
michael@0 | 22 | var iter = iterable[std_iterator](); |
michael@0 | 23 | do { |
michael@0 | 24 | result = iter.next(); |
michael@0 | 25 | ret.push(result); |
michael@0 | 26 | } while (!result.done); |
michael@0 | 27 | return ret; |
michael@0 | 28 | } |
michael@0 | 29 | |
michael@0 | 30 | // We have to put a full result for the end, because the return will re-box. |
michael@0 | 31 | var expected = [{value: 1}, 13, "foo", {value: 34, done: true}]; |
michael@0 | 32 | |
michael@0 | 33 | assertDeepEq(expected, collect_results(results(expected))); |
michael@0 | 34 | assertDeepEq(expected, collect_results(yield_results(expected, 20))); |
michael@0 | 35 | |
michael@0 | 36 | if (typeof reportCompare == "function") |
michael@0 | 37 | reportCompare(true, true); |