js/src/jit-test/tests/for-of/string-iterator-generic.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 // String.prototype.iterator is generic.
     3 load(libdir + "asserts.js");
     4 load(libdir + "iteration.js");
     5 load(libdir + "string.js");
     7 function test(obj) {
     8     var it = String.prototype[std_iterator].call(obj);
     9     var s = String(obj);
    10     for (var i = 0, length = s.length; i < length;) {
    11         var r = s[i++];
    12         if (isHighSurrogate(r) && i < length && isLowSurrogate(s[i])) {
    13             r += s[i++];
    14         }
    15         assertIteratorNext(it, r);
    16     }
    17     assertIteratorDone(it, undefined);
    18 }
    20 test({toString: () => ""});
    21 test({toString: () => "xyz"});
    22 test({toString: () => "\ud808\udf45"});
    23 test({valueOf: () => ""});
    24 test({valueOf: () => "xyz"});
    25 test({valueOf: () => "\ud808\udf45"});

mercurial