js/src/tests/ecma_5/Array/unshift-01.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 /*
     2  * Any copyright is dedicated to the Public Domain.
     3  * http://creativecommons.org/licenses/publicdomain/
     4  */
     6 //-----------------------------------------------------------------------------
     7 var BUGNUMBER = 614070;
     8 var summary = 'Array.prototype.unshift without args';
    10 print(BUGNUMBER + ": " + summary);
    12 /**************
    13  * BEGIN TEST *
    14  **************/
    16 var a = {};
    17 a.length = 4294967296;
    18 assertEq([].unshift.call(a), 0);
    19 assertEq(a.length, 0);
    21 function testGetSet(len, expected) {
    22     var newlen;
    23     var a = { get length() { return len; }, set length(v) { newlen = v; } };
    24     var res = [].unshift.call(a);
    25     assertEq(res, expected);
    26     assertEq(newlen, expected);
    27 }
    29 testGetSet(0, 0);
    30 testGetSet(10, 10);
    31 testGetSet("1", 1);
    32 testGetSet(null, 0);
    33 testGetSet(4294967297, 1);
    34 testGetSet(-5, 4294967291);
    36 /******************************************************************************/
    38 if (typeof reportCompare === "function")
    39   reportCompare(true, true);
    41 print("All tests passed!");

mercurial