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 | // The LHS of a for-of loop is not evaluated until after the .next() method returns. |
michael@0 | 2 | |
michael@0 | 3 | var s; |
michael@0 | 4 | function f() { |
michael@0 | 5 | s += 'f'; |
michael@0 | 6 | return {}; |
michael@0 | 7 | } |
michael@0 | 8 | |
michael@0 | 9 | // Test 1: .next() throws StopIteration right away. f is never called. |
michael@0 | 10 | s = ''; |
michael@0 | 11 | for (f().x of []) |
michael@0 | 12 | s += '.'; |
michael@0 | 13 | assertEq(s, ''); |
michael@0 | 14 | |
michael@0 | 15 | // Test 2: check proper interleaving of f calls, iterator.next() calls, and the loop body. |
michael@0 | 16 | function g() { |
michael@0 | 17 | s += 'g'; |
michael@0 | 18 | yield 0; |
michael@0 | 19 | s += 'g'; |
michael@0 | 20 | yield 1; |
michael@0 | 21 | s += 'g'; |
michael@0 | 22 | } |
michael@0 | 23 | for (f().x of g()) |
michael@0 | 24 | s += '.'; |
michael@0 | 25 | assertEq(s, 'gf.gf.g'); |