js/src/tests/js1_5/Array/regress-107138.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: 29 October 2001
     8  *
     9  * SUMMARY: Regression test for bug 107138
    10  * See http://bugzilla.mozilla.org/show_bug.cgi?id=107138
    11  *
    12  * The bug: arr['1'] == undefined instead of arr['1'] == 'one'.
    13  * The bug was intermittent and did not always occur...
    14  *
    15  * The cnSTRESS constant defines how many times to repeat this test.
    16  */
    17 //-----------------------------------------------------------------------------
    18 var UBound = 0;
    19 var cnSTRESS = 10;
    20 var cnDASH = '-';
    21 var BUGNUMBER = 107138;
    22 var summary = 'Regression test for bug 107138';
    23 var status = '';
    24 var statusitems = [];
    25 var actual = '';
    26 var actualvalues = [];
    27 var expect= '';
    28 var expectedvalues = [];
    31 var arr = ['zero', 'one', 'two', 'three', 'four', 'five',
    32            'six', 'seven', 'eight', 'nine', 'ten'];
    35 // This bug was intermittent. Stress-test it.
    36 for (var j=0; j<cnSTRESS; j++)
    37 {
    38   status = inSection(j + cnDASH + 1);
    39   actual = arr[0];
    40   expect = 'zero';
    41   addThis();
    43   status = inSection(j + cnDASH + 2);
    44   actual = arr['0'];
    45   expect = 'zero';
    46   addThis();
    48   status = inSection(j + cnDASH + 3);
    49   actual = arr[1];
    50   expect = 'one';
    51   addThis();
    53   status = inSection(j + cnDASH + 4);
    54   actual = arr['1'];
    55   expect = 'one';
    56   addThis();
    58   status = inSection(j + cnDASH + 5);
    59   actual = arr[2];
    60   expect = 'two';
    61   addThis();
    63   status = inSection(j + cnDASH + 6);
    64   actual = arr['2'];
    65   expect = 'two';
    66   addThis();
    68   status = inSection(j + cnDASH + 7);
    69   actual = arr[3];
    70   expect = 'three';
    71   addThis();
    73   status = inSection(j + cnDASH + 8);
    74   actual = arr['3'];
    75   expect = 'three';
    76   addThis();
    78   status = inSection(j + cnDASH + 9);
    79   actual = arr[4];
    80   expect = 'four';
    81   addThis();
    83   status = inSection(j + cnDASH + 10);
    84   actual = arr['4'];
    85   expect = 'four';
    86   addThis();
    88   status = inSection(j + cnDASH + 11);
    89   actual = arr[5];
    90   expect = 'five';
    91   addThis();
    93   status = inSection(j + cnDASH + 12);
    94   actual = arr['5'];
    95   expect = 'five';
    96   addThis();
    98   status = inSection(j + cnDASH + 13);
    99   actual = arr[6];
   100   expect = 'six';
   101   addThis();
   103   status = inSection(j + cnDASH + 14);
   104   actual = arr['6'];
   105   expect = 'six';
   106   addThis();
   108   status = inSection(j + cnDASH + 15);
   109   actual = arr[7];
   110   expect = 'seven';
   111   addThis();
   113   status = inSection(j + cnDASH + 16);
   114   actual = arr['7'];
   115   expect = 'seven';
   116   addThis();
   118   status = inSection(j + cnDASH + 17);
   119   actual = arr[8];
   120   expect = 'eight';
   121   addThis();
   123   status = inSection(j + cnDASH + 18);
   124   actual = arr['8'];
   125   expect = 'eight';
   126   addThis();
   128   status = inSection(j + cnDASH + 19);
   129   actual = arr[9];
   130   expect = 'nine';
   131   addThis();
   133   status = inSection(j + cnDASH + 20);
   134   actual = arr['9'];
   135   expect = 'nine';
   136   addThis();
   138   status = inSection(j + cnDASH + 21);
   139   actual = arr[10];
   140   expect = 'ten';
   141   addThis();
   143   status = inSection(j + cnDASH + 22);
   144   actual = arr['10'];
   145   expect = 'ten';
   146   addThis();
   147 }
   150 //-----------------------------------------------------------------------------
   151 test();
   152 //-----------------------------------------------------------------------------
   156 function addThis()
   157 {
   158   statusitems[UBound] = status;
   159   actualvalues[UBound] = actual;
   160   expectedvalues[UBound] = expect;
   161   UBound++;
   162 }
   165 function test()
   166 {
   167   enterFunc ('test');
   168   printBugNumber(BUGNUMBER);
   169   printStatus (summary);
   171   for (var i=0; i<UBound; i++)
   172   {
   173     reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
   174   }
   176   exitFunc ('test');
   177 }

mercurial