js/src/jit-test/tests/for-of/semantics-10.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-loop is not bound to a particular scope until after the .next() method returns.
     3 var obj = {};
     5 // Test 1
     6 function g() {
     7     obj.x = 0;
     8     yield 1;
     9 }
    10 var x = 2, n = 0;
    11 with (obj) {
    12     for (x of g())  // g().next() inserts a binding for x on obj
    13         n++;
    14 }
    15 assertEq(x, 2);
    16 assertEq(obj.x, 1);
    17 assertEq(n, 1);
    19 // Test 2
    20 function h() {
    21     delete obj.x;
    22     yield 3;
    23 }
    24 n = 0;
    25 with (obj) {
    26     for (x of h())  // h().next() deletes the binding for x on obj
    27         n++;
    28 }
    29 assertEq(x, 3);
    30 assertEq("x" in obj, false);
    31 assertEq(n, 1);

mercurial