js/src/jit-test/tests/for-of/semantics-09.js

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

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

mercurial