js/src/jit-test/tests/basic/array-slice.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 function check_specified_range_zero_base_slice() {
michael@0 2 var arr = new Array(32)
michael@0 3 arr[0]=0, arr[1]=1, arr[7]=7;
michael@0 4 var res = arr.slice(0,10);
michael@0 5 assertEq(arr[0],res[0]);
michael@0 6 assertEq(arr[1],res[1]);
michael@0 7 assertEq(arr[7],res[7]);
michael@0 8 assertEq(res.length,10);
michael@0 9 }
michael@0 10
michael@0 11 function check_specified_range_slice() {
michael@0 12 var arr = new Array(32)
michael@0 13 arr[0]=0, arr[6]=1, arr[8]=3;
michael@0 14 var res = arr.slice(5,9);
michael@0 15 assertEq(arr[6],res[1]);
michael@0 16 assertEq(arr[8],res[3]);
michael@0 17 assertEq(res.length,4);
michael@0 18 }
michael@0 19
michael@0 20 function check_all_range_slice() {
michael@0 21 var arr = new Array(32)
michael@0 22 arr[0]=0, arr[6]=1, arr[8]=3;
michael@0 23 var res = arr.slice();
michael@0 24 assertEq(arr[0],res[0]);
michael@0 25 assertEq(arr[6],res[6]);
michael@0 26 assertEq(arr[8],res[8]);
michael@0 27 assertEq(res.length,32);
michael@0 28 }
michael@0 29
michael@0 30 check_all_range_slice();
michael@0 31 check_specified_range_slice();
michael@0 32 check_specified_range_zero_base_slice();

mercurial