js/src/tests/ecma_3/RegExp/15.10.4.1-6.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   15.10.4.1 new RegExp(pattern, flags)
     9   If F contains any character other than "g", "i", or" m", or if it
    10   contains the same one more than once, then throw a SyntaxError
    11   exception.
    12 */
    14 //-----------------------------------------------------------------------------
    15 var BUGNUMBER = 476940;
    16 var summary = 'Section 15.10.4.1 - RegExp with invalid flags';
    17 var actual = '';
    18 var expect = '';
    21 //-----------------------------------------------------------------------------
    22 test();
    23 //-----------------------------------------------------------------------------
    25 function test()
    26 {
    27   enterFunc ('test');
    28   printBugNumber(BUGNUMBER);
    29   printStatus (summary);
    31   var invalidflags = ['ii', 'gg', 'mm', 'a'];
    33   for (var i = 0; i < invalidflags.length; i++)
    34   {
    35     var flag = invalidflags[i];
    36     expect = 'SyntaxError: invalid regular expression flag ' + flag.charAt(0);
    37     actual = '';
    38     try
    39     {
    40       new RegExp('bar', flag);
    41     }
    42     catch(ex)
    43     {
    44       actual = ex + '';
    45     }
    46     reportCompare(expect, actual, summary + 
    47                   ': new RegExp("bar", "' + flag + '")');
    49     actual = '';
    50     try
    51     {
    52       eval("/bar/" + flag);
    53     }
    54     catch(ex)
    55     {
    56       actual = ex + '';
    57     }
    58     reportCompare(expect, actual, summary + ': /bar/' + flag + ')');
    59   }
    61   exitFunc ('test');
    62 }

mercurial