js/src/tests/ecma_3/RegExp/regress-123437.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:    04 Feb 2002
     9  * SUMMARY: regexp backreferences must hold |undefined| if not used
    10  *
    11  * See http://bugzilla.mozilla.org/show_bug.cgi?id=123437 (SpiderMonkey)
    12  * See http://bugzilla.mozilla.org/show_bug.cgi?id=123439 (Rhino)
    13  *
    14  */
    15 //-----------------------------------------------------------------------------
    16 var i = 0;
    17 var BUGNUMBER = 123437;
    18 var summary = 'regexp backreferences must hold |undefined| if not used';
    19 var status = '';
    20 var statusmessages = new Array();
    21 var pattern = '';
    22 var patterns = new Array();
    23 var string = '';
    24 var strings = new Array();
    25 var actualmatch = '';
    26 var actualmatches = new Array();
    27 var expectedmatch = '';
    28 var expectedmatches = new Array();
    31 pattern = /(a)?a/;
    32 string = 'a';
    33 status = inSection(1);
    34 actualmatch = string.match(pattern);
    35 expectedmatch = Array('a', undefined);
    36 addThis();
    38 pattern = /a|(b)/;
    39 string = 'a';
    40 status = inSection(2);
    41 actualmatch = string.match(pattern);
    42 expectedmatch = Array('a', undefined);
    43 addThis();
    45 pattern = /(a)?(a)/;
    46 string = 'a';
    47 status = inSection(3);
    48 actualmatch = string.match(pattern);
    49 expectedmatch = Array('a', undefined, 'a');
    50 addThis();
    54 //-----------------------------------------------------------------------------
    55 test();
    56 //-----------------------------------------------------------------------------
    60 function addThis()
    61 {
    62   statusmessages[i] = status;
    63   patterns[i] = pattern;
    64   strings[i] = string;
    65   actualmatches[i] = actualmatch;
    66   expectedmatches[i] = expectedmatch;
    67   i++;
    68 }
    71 function test()
    72 {
    73   enterFunc ('test');
    74   printBugNumber(BUGNUMBER);
    75   printStatus (summary);
    76   testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches);
    77   exitFunc ('test');
    78 }

mercurial