js/src/jit-test/tests/for-of/array-iterator-surfaces-2.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 // Superficial tests for iterators created by Array.prototype.iterator
     3 load(libdir + "iteration.js");
     5 var proto = Object.getPrototypeOf([][std_iterator]());
     6 assertEq(Object.getPrototypeOf(proto), Iterator.prototype);
     7 proto = Object.getPrototypeOf([].keys());
     8 assertEq(Object.getPrototypeOf(proto), Iterator.prototype);
     9 proto = Object.getPrototypeOf([].entries());
    10 assertEq(Object.getPrototypeOf(proto), Iterator.prototype);
    12 function check(it) {
    13     assertEq(typeof it, 'object');
    14     assertEq(Object.getPrototypeOf(it), proto);
    15     assertEq(Object.getOwnPropertyNames(it).length, 0);
    16     assertEq(it[std_iterator](), it);
    18     // for-in enumerates the iterator's properties.
    19     it.x = 0;
    20     var s = '';
    21     for (var p in it)
    22         s += p + '.';
    23     assertEq(s, 'x.');
    24 }
    26 check([][std_iterator]());
    27 check(Array.prototype[std_iterator].call({}));
    28 check([].keys());
    29 check(Array.prototype.keys.call({}));
    30 check([].entries());
    31 check(Array.prototype.entries.call({}));

mercurial