js/src/tests/ecma_3/RegExp/regress-465862.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 var BUGNUMBER = 465862;
     8 var summary = 'Do case-insensitive matching correctly in JIT for non-ASCII-letters';
    10 var i = 0;
    11 var status = '';
    12 var statusmessages = new Array();
    13 var pattern = '';
    14 var patterns = new Array();
    15 var string = '';
    16 var strings = new Array();
    17 var actualmatch = '';
    18 var actualmatches = new Array();
    19 var expectedmatch = '';
    20 var expectedmatches = new Array();
    22 // Note: we must call the RegExp constructor here instead of using
    23 // literals. Otherwise, because the regexps are compiled at parse
    24 // time, they will not be compiled to native code and we will not
    25 // actually be testing jitted regexps.
    27 jit(true);
    29 status = inSection(1);
    30 string = '@';
    31 pattern = new RegExp('@', 'i');
    32 actualmatch = string.match(pattern);
    33 expectedmatch = Array(string);
    34 addThis();
    36 status = inSection(2);
    37 string = '`';
    38 pattern = new RegExp('`', 'i');
    39 actualmatch = string.match(pattern);
    40 expectedmatch = Array(string);
    41 addThis();
    43 status = inSection(3);
    44 string = '@';
    45 pattern = new RegExp('`', 'i');
    46 actualmatch = string.match(pattern);
    47 expectedmatch = null;
    48 addThis();
    50 status = inSection(4);
    51 string = '`';
    52 pattern = new RegExp('@', 'i');
    53 print(string + ' ' + pattern);
    54 actualmatch = string.match(pattern);
    55 print('z ' + actualmatch);
    56 print('`'.match(/@/i));
    57 expectedmatch = null;
    58 addThis();
    60 jit(false);
    62 //-----------------------------------------------------------------------------
    63 test();
    64 //-----------------------------------------------------------------------------
    66 function addThis()
    67 {
    68   statusmessages[i] = status;
    69   patterns[i] = pattern;
    70   strings[i] = string;
    71   actualmatches[i] = actualmatch;
    72   expectedmatches[i] = expectedmatch;
    73   i++;
    74 }
    77 function test()
    78 {
    79   enterFunc ('test');
    80   printBugNumber(BUGNUMBER);
    81   printStatus (summary);
    82   testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches);
    83   exitFunc ('test');
    84 }

mercurial