js/src/jit-test/tests/baseline/setcall.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 var calls = 0;
michael@0 2 function g() {
michael@0 3 calls++;
michael@0 4 };
michael@0 5 function test1() {
michael@0 6 for (var i=0; i<20; i++) {
michael@0 7 if (i > 18)
michael@0 8 g() = 2;
michael@0 9 }
michael@0 10 }
michael@0 11 try {
michael@0 12 test1();
michael@0 13 assertEq(0, 1);
michael@0 14 } catch(e) {
michael@0 15 assertEq(e instanceof ReferenceError, true);
michael@0 16 }
michael@0 17
michael@0 18 assertEq(calls, 1);
michael@0 19
michael@0 20 function test2() {
michael@0 21 for (var i=0; i<20; i++) {
michael@0 22 if (i > 18)
michael@0 23 g()++;
michael@0 24 }
michael@0 25 }
michael@0 26 try {
michael@0 27 test2();
michael@0 28 assertEq(0, 1);
michael@0 29 } catch(e) {
michael@0 30 assertEq(e instanceof ReferenceError, true);
michael@0 31 }
michael@0 32 assertEq(calls, 2);
michael@0 33
michael@0 34 function test3() {
michael@0 35 var v1, v2, v3;
michael@0 36 var z = [1, 2, 3];
michael@0 37 for (var i=0; i<15; i++) {
michael@0 38 if (i > 12)
michael@0 39 [v1, v2, g(), v3] = z
michael@0 40 }
michael@0 41 }
michael@0 42 try {
michael@0 43 test3();
michael@0 44 assertEq(0, 1);
michael@0 45 } catch(e) {
michael@0 46 assertEq(e instanceof ReferenceError, true);
michael@0 47 }
michael@0 48 assertEq(calls, 3);
michael@0 49
michael@0 50 function test4() {
michael@0 51 for (var i=0; i<20; i++) {
michael@0 52 if (i > 18)
michael@0 53 g() >>= 2;
michael@0 54 }
michael@0 55 }
michael@0 56 try {
michael@0 57 test4();
michael@0 58 assertEq(0, 1);
michael@0 59 } catch(e) {
michael@0 60 assertEq(e instanceof ReferenceError, true);
michael@0 61 }
michael@0 62
michael@0 63 assertEq(calls, 4);

mercurial