js/src/tests/ecma_3/RegExp/regress-72964.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: 2001-07-17
     8  *
     9  * SUMMARY: Regression test for Bugzilla bug 72964:
    10  * "String method for pattern matching failed for Chinese Simplified (GB2312)"
    11  *
    12  * See http://bugzilla.mozilla.org/show_bug.cgi?id=72964
    13  */
    14 //-----------------------------------------------------------------------------
    15 var i = 0;
    16 var BUGNUMBER = 72964;
    17 var summary = 'Testing regular expressions containing non-Latin1 characters';
    18 var cnSingleSpace = ' ';
    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 = /[\S]+/;
    32 // 4 low Unicode chars = Latin1; whole string should match
    33 status = inSection(1);
    34 string = '\u00BF\u00CD\u00BB\u00A7';
    35 actualmatch = string.match(pattern);
    36 expectedmatch = Array(string);
    37 addThis();
    39 // Now put a space in the middle; first half of string should match
    40 status = inSection(2);
    41 string = '\u00BF\u00CD \u00BB\u00A7';
    42 actualmatch = string.match(pattern);
    43 expectedmatch = Array('\u00BF\u00CD');
    44 addThis();
    47 // 4 high Unicode chars = non-Latin1; whole string should match
    48 status = inSection(3);
    49 string = '\u4e00\uac00\u4e03\u4e00';
    50 actualmatch = string.match(pattern);
    51 expectedmatch = Array(string);
    52 addThis();
    54 // Now put a space in the middle; first half of string should match
    55 status = inSection(4);
    56 string = '\u4e00\uac00 \u4e03\u4e00';
    57 actualmatch = string.match(pattern);
    58 expectedmatch = Array('\u4e00\uac00');
    59 addThis();
    63 //-----------------------------------------------------------------------------
    64 test();
    65 //-----------------------------------------------------------------------------
    69 function addThis()
    70 {
    71   statusmessages[i] = status;
    72   patterns[i] = pattern;
    73   strings[i] = string;
    74   actualmatches[i] = actualmatch;
    75   expectedmatches[i] = expectedmatch;
    76   i++;
    77 }
    80 function test()
    81 {
    82   enterFunc ('test');
    83   printBugNumber(BUGNUMBER);
    84   printStatus (summary);
    85   testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches);
    86   exitFunc ('test');
    87 }

mercurial