js/src/jit-test/tests/for-of/semantics-11.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 // for-of on a proxy causes a predictable sequence of trap calls.
     3 load(libdir + "iteration.js");
     5 var s = '';
     7 var i = 0;
     8 var next_fn = Proxy.createFunction({}, function () {
     9     s += "n";
    10     if (i == 3)
    11         return { value: undefined, done: true };
    12     return { value: i++, done: false };
    13 });
    15 var it = Proxy.create({
    16     get: function (receiver, name) {
    17         if (name == 'toSource') {
    18             s += '?';
    19             return function () 'it';
    20         }
    21         assertEq(name, "next");
    22         s += "N";
    23         return next_fn;
    24     }
    25 });
    27 var iterator_fn = Proxy.createFunction({}, function () {
    28     s += 'i';
    29     return it;
    30 });
    32 var obj = Proxy.create({
    33     get: function (receiver, name) {
    34         assertEq(name, std_iterator);
    35         s += "I";
    36         return iterator_fn;
    37     }
    38 });
    40 for (var v of obj)
    41     s += v;
    43 assertEq(s, 'IiNn0Nn1Nn2Nn');

mercurial