js/src/jit-test/tests/ion/inlining/array-push.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 test1() {
     2     function push(arr, x) {
     3         return arr.push(x);
     4     }
     5     var arr = [];
     6     for (var i=0; i<100; i++) {
     7         assertEq(push(arr, i), i + 1);
     8     }
     9 }
    10 test1();
    12 function test2() {
    13     var arr;
    14     for (var i=0; i<60; i++) {
    15         arr = [];
    16         assertEq(arr.push(3.3), 1);
    17         assertEq(arr.push(undefined), 2);
    18         assertEq(arr.push(true), 3);
    19         assertEq(arr.push(Math), 4);
    20         assertEq(arr.toString(), "3.3,,true,[object Math]");
    21     }
    22 }
    23 test2();
    25 function test3() {
    26     function push(arr, v) {
    27         arr.push(v);
    28     }
    29     for (var i=0; i<60; i++) {
    30         var arr = [];
    31         push(arr, null);
    32         push(arr, 3.14);
    33         push(arr, {});
    34         assertEq(arr.toString(), ",3.14,[object Object]");
    35     }
    36 }
    37 test3();

mercurial