js/src/tests/js1_5/String/regress-107771.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  * Date: 31 October 2001
     8  *
     9  * SUMMARY: Regression test for bug 107771
    10  * See http://bugzilla.mozilla.org/show_bug.cgi?id=107771
    11  *
    12  * The bug: Section 1 passed, but Sections 2-5 all failed with |actual| == 12
    13  */
    14 //-----------------------------------------------------------------------------
    15 var UBound = 0;
    16 var BUGNUMBER = 107771;
    17 var summary = "Regression test for bug 107771";
    18 var status = '';
    19 var statusitems = [];
    20 var actual = '';
    21 var actualvalues = [];
    22 var expect= '';
    23 var expectedvalues = [];
    24 var str = '';
    25 var k = -9999;
    28 status = inSection(1);
    29 str = "AAA//BBB/CCC/";
    30 k = str.lastIndexOf('/');
    31 actual = k;
    32 expect = 12;
    34 status = inSection(2);
    35 str = str.substring(0, k);
    36 k = str.lastIndexOf('/');
    37 actual = k;
    38 expect = 8;
    39 addThis();
    41 status = inSection(3);
    42 str = str.substring(0, k);
    43 k = str.lastIndexOf('/');
    44 actual = k;
    45 expect = 4;
    46 addThis();
    48 status = inSection(4);
    49 str = str.substring(0, k);
    50 k = str.lastIndexOf('/');
    51 actual = k;
    52 expect = 3;
    53 addThis();
    55 status = inSection(5);
    56 str = str.substring(0, k);
    57 k = str.lastIndexOf('/');
    58 actual = k;
    59 expect = -1;
    60 addThis();
    64 //-----------------------------------------------------------------------------
    65 test();
    66 //-----------------------------------------------------------------------------
    70 function addThis()
    71 {
    72   statusitems[UBound] = status;
    73   actualvalues[UBound] = actual;
    74   expectedvalues[UBound] = expect;
    75   UBound++;
    76 }
    79 function test()
    80 {
    81   enterFunc ('test');
    82   printBugNumber(BUGNUMBER);
    83   printStatus (summary);
    85   for (var i=0; i<UBound; i++)
    86   {
    87     reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
    88   }
    90   exitFunc ('test');
    91 }

mercurial