js/src/jit-test/tests/arguments/defaults-evaluation-order.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 f1(a, bIs, cIs, dIs, b=a, c=d, d=5) {
     2     assertEq(a, 1);
     3     assertEq(b, bIs);
     4     assertEq(c, cIs);
     5     assertEq(d, dIs);
     6 }
     7 f1(1, 1, undefined, 5);
     8 f1(1, 42, undefined, 5, 42);
     9 f1(1, 42, 43, 5, 42, 43);
    10 f1(1, 42, 43, 44, 42, 43, 44);
    11 function f2(a=[]) { return a; }
    12 assertEq(f2() !== f2(), true);
    13 function f3(a=function () {}) { return a; }
    14 assertEq(f3() !== f3(), true);
    15 function f4(a=Date) { return a; }
    16 assertEq(f4(), Date);
    17 Date = 0;
    18 assertEq(f4(), 0);
    19 function f5(x=FAIL()) {};  // don't throw
    20 var n = 0;
    21 function f6(a=n++) {}
    22 assertEq(n, 0);
    23 function f7([a, b], A=a, B=b) {
    24     assertEq(A, a);
    25     assertEq(B, b);
    26 }
    27 f7([0, 1]);

mercurial