js/src/jit-test/tests/basic/testSwitch.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 function testSwitch() {
     2     var x = 0;
     3     var ret = 0;
     4     for (var i = 0; i < 100; ++i) {
     5         switch (x) {
     6             case 0:
     7                 ret += 1;
     8                 break;
     9             case 1:
    10                 ret += 2;
    11                 break;
    12             case 2:
    13                 ret += 3;
    14                 break;
    15             case 3:
    16                 ret += 4;
    17                 break;
    18             default:
    19                 x = 0;
    20         }
    21         x++;
    22     }
    23     return ret;
    24 }
    25 assertEq(testSwitch(), 226);

mercurial