js/src/jit-test/tests/collections/Map-clear-iterators-1.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 // A Map iterator does not visit entries removed by clear().
     3 load(libdir + "iteration.js");
     5 var m = Map();
     6 var it = m[std_iterator]();
     7 m.clear();
     8 assertIteratorDone(it, undefined);
    10 m = Map([["a", 1], ["b", 2], ["c", 3], ["d", 4]]);
    11 it = m[std_iterator]();
    12 assertIteratorNext(it, ["a", 1]);
    13 m.clear();
    14 assertIteratorDone(it, undefined);
    16 var log = "";
    17 m = Map([["a", 1], ["b", 2], ["c", 3], ["d", 4]]);
    18 for (var [k, v] of m) {
    19     log += k + v;
    20     if (k == "b")
    21         m.clear();
    22 }
    23 assertEq(log, "a1b2");

mercurial