js/src/tests/js1_2/regexp/string_search.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/. */
     7 /**
     8    Filename:     string_search.js
     9    Description:  'Tests the search method on Strings using regular expressions'
    11    Author:       Nick Lerissa
    12    Date:         March 12, 1998
    13 */
    15 var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
    16 var VERSION = 'no version';
    17 startTest();
    18 var TITLE   = 'String: search';
    20 writeHeaderToLog('Executing script: string_search.js');
    21 writeHeaderToLog( SECTION + " "+ TITLE);
    23 // 'abcdefg'.search(/d/)
    24 new TestCase ( SECTION, "'abcdefg'.search(/d/)",
    25 	       3, 'abcdefg'.search(/d/));
    27 // 'abcdefg'.search(/x/)
    28 new TestCase ( SECTION, "'abcdefg'.search(/x/)",
    29 	       -1, 'abcdefg'.search(/x/));
    31 // 'abcdefg123456hijklmn'.search(/\d+/)
    32 new TestCase ( SECTION, "'abcdefg123456hijklmn'.search(/\d+/)",
    33 	       7, 'abcdefg123456hijklmn'.search(/\d+/));
    35 // 'abcdefg123456hijklmn'.search(new RegExp())
    36 new TestCase ( SECTION, "'abcdefg123456hijklmn'.search(new RegExp())",
    37 	       0, 'abcdefg123456hijklmn'.search(new RegExp()));
    39 // 'abc'.search(new RegExp('$'))
    40 new TestCase ( SECTION, "'abc'.search(new RegExp('$'))",
    41 	       3, 'abc'.search(new RegExp('$')));
    43 // 'abc'.search(new RegExp('^'))
    44 new TestCase ( SECTION, "'abc'.search(new RegExp('^'))",
    45 	       0, 'abc'.search(new RegExp('^')));
    47 // 'abc1'.search(/.\d/)
    48 new TestCase ( SECTION, "'abc1'.search(/.\d/)",
    49 	       2, 'abc1'.search(/.\d/));
    51 // 'abc1'.search(/\d{2}/)
    52 new TestCase ( SECTION, "'abc1'.search(/\d{2}/)",
    53 	       -1, 'abc1'.search(/\d{2}/));
    55 test();

mercurial