js/src/tests/js1_5/Array/regress-154338.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 /* This Source Code Form is subject to the terms of the Mozilla Public
     3  * License, v. 2.0. If a copy of the MPL was not distributed with this
     4  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     6 /*
     7  *
     8  * Date:    26 June 2002
     9  * SUMMARY: Testing array.join() when separator is a variable, not a literal
    10  * See http://bugzilla.mozilla.org/show_bug.cgi?id=154338
    11  *
    12  */
    13 //-----------------------------------------------------------------------------
    14 var UBound = 0;
    15 var BUGNUMBER = 154338;
    16 var summary = 'Test array.join() when separator is a variable, not a literal';
    17 var status = '';
    18 var statusitems = [];
    19 var actual = '';
    20 var actualvalues = [];
    21 var expect= '';
    22 var expectedvalues = [];
    25 /*
    26  * Note that x === 'H' and y === 'ome'.
    27  *
    28  * Yet for some reason, using |x| or |y| as the separator
    29  * in arr.join() was causing out-of-memory errors, whereas
    30  * using the literals 'H', 'ome' was not -
    31  *
    32  */
    33 var x = 'Home'[0];
    34 var y = ('Home'.split('H'))[1];
    37 status = inSection(1);
    38 var arr = Array('a', 'b');
    39 actual = arr.join('H');
    40 expect = 'aHb';
    41 addThis();
    43 status = inSection(2);
    44 arr = Array('a', 'b');
    45 actual = arr.join(x);
    46 expect = 'aHb';
    47 addThis();
    49 status = inSection(3);
    50 arr = Array('a', 'b');
    51 actual = arr.join('ome');
    52 expect = 'aomeb';
    53 addThis();
    55 status = inSection(4);
    56 arr = Array('a', 'b');
    57 actual = arr.join(y);
    58 expect = 'aomeb';
    59 addThis();
    63 //-----------------------------------------------------------------------------
    64 test();
    65 //-----------------------------------------------------------------------------
    69 function addThis()
    70 {
    71   statusitems[UBound] = status;
    72   actualvalues[UBound] = actual;
    73   expectedvalues[UBound] = expect;
    74   UBound++;
    75 }
    78 function test()
    79 {
    80   enterFunc('test');
    81   printBugNumber(BUGNUMBER);
    82   printStatus(summary);
    84   for (var i=0; i<UBound; i++)
    85   {
    86     reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
    87   }
    89   exitFunc ('test');
    90 }

mercurial