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.

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

mercurial