js/src/tests/js1_6/Array/regress-386030.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 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     2 /*
     3  * Any copyright is dedicated to the Public Domain.
     4  * http://creativecommons.org/licenses/publicdomain/
     5  * Contributor: Blake Kaplan
     6  */
     8 //-----------------------------------------------------------------------------
     9 var BUGNUMBER = 386030;
    10 var summary = 'Array.reduce should ignore holes';
    11 var actual = '';
    12 var expect = '';
    15 //-----------------------------------------------------------------------------
    16 test();
    17 //-----------------------------------------------------------------------------
    19 function test()
    20 {
    21   enterFunc ('test');
    22   printBugNumber(BUGNUMBER);
    23   printStatus (summary);
    25   function add(a, b) { return a + b; }
    26   function testreduce(v) { return v == 3 ? "PASS" : "FAIL"; }
    28   expect = 'PASS';
    30   try {
    31     a = new Array(2);
    32     a[1] = 3;
    33     actual = testreduce(a.reduce(add));
    34   } catch (e) {
    35     actual = "FAIL, reduce";
    36   }
    37   reportCompare(expect, actual, summary + ': 1');
    39   try {
    40     a = new Array(2);
    41     a[0] = 3;
    42     actual = testreduce(a.reduceRight(add));
    43   } catch (e) {
    44     actual = "FAIL, reduceRight";
    45   }
    46   reportCompare(expect, actual, summary + ': 2');
    48   try {
    49     a = new Array(2);
    50     a.reduce(add);
    51     actual = "FAIL, empty reduce";
    52   } catch (e) {
    53     actual = "PASS";
    54   }
    55   reportCompare(expect, actual, summary + ': 3');
    57   try {
    58     a = new Array(2);
    59     print(a.reduceRight(add));
    60     actual = "FAIL, empty reduceRight";
    61   } catch (e) {
    62     actual = "PASS";
    63   }
    64   reportCompare(expect, actual, summary + ': 4');
    66   exitFunc ('test');
    67 }

mercurial