js/src/tests/ecma_2/RegExp/properties-001.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  *  File Name:          RegExp/properties-001.js
     9  *  ECMA Section:       15.7.6.js
    10  *  Description:        Based on ECMA 2 Draft 7 February 1999
    11  *
    12  *  Author:             christine@netscape.com
    13  *  Date:               19 February 1999
    14  */
    15 var SECTION = "RegExp/properties-001.js";
    16 var VERSION = "ECMA_2";
    17 var TITLE   = "Properties of RegExp Instances";
    18 var BUGNUMBER ="";
    20 startTest();
    22 AddRegExpCases( new RegExp, "",   false, false, false, 0 );
    23 AddRegExpCases( /.*/,       ".*", false, false, false, 0 );
    24 AddRegExpCases( /[\d]{5}/g, "[\\d]{5}", true, false, false, 0 );
    25 AddRegExpCases( /[\S]?$/i,  "[\\S]?$", false, true, false, 0 );
    26 AddRegExpCases( /^([a-z]*)[^\w\s\f\n\r]+/m,  "^([a-z]*)[^\\w\\s\\f\\n\\r]+", false, false, true, 0 );
    27 AddRegExpCases( /[\D]{1,5}[\ -][\d]/gi,      "[\\D]{1,5}[\\ -][\\d]", true, true, false, 0 );
    28 AddRegExpCases( /[a-zA-Z0-9]*/gm, "[a-zA-Z0-9]*", true, false, true, 0 );
    29 AddRegExpCases( /x|y|z/gim, "x|y|z", true, true, true, 0 );
    31 AddRegExpCases( /\u0051/im, "\\u0051", false, true, true, 0 );
    32 AddRegExpCases( /\x45/gm, "\\x45", true, false, true, 0 );
    33 AddRegExpCases( /\097/gi, "\\097", true, true, false, 0 );
    35 test();
    37 function AddRegExpCases( re, s, g, i, m, l ) {
    39   AddTestCase( re + ".test == RegExp.prototype.test",
    40 	       true,
    41 	       re.test == RegExp.prototype.test );
    43   AddTestCase( re + ".toString == RegExp.prototype.toString",
    44 	       true,
    45 	       re.toString == RegExp.prototype.toString );
    47   AddTestCase( re + ".contructor == RegExp.prototype.constructor",
    48 	       true,
    49 	       re.constructor == RegExp.prototype.constructor );
    51   AddTestCase( re + ".compile == RegExp.prototype.compile",
    52 	       true,
    53 	       re.compile == RegExp.prototype.compile );
    55   AddTestCase( re + ".exec == RegExp.prototype.exec",
    56 	       true,
    57 	       re.exec == RegExp.prototype.exec );
    59   // properties
    61   AddTestCase( re + ".source",
    62 	       s,
    63 	       re.source );
    65 /*
    66  * http://bugzilla.mozilla.org/show_bug.cgi?id=225550 changed
    67  * the behavior of toString() and toSource() on empty regexps.
    68  * So branch if |s| is the empty string -
    69  */
    70   var S = s? s : '(?:)';
    72   AddTestCase( re + ".toString()",
    73 	       "/" + S +"/" + (g?"g":"") + (i?"i":"") +(m?"m":""),
    74 	       re.toString() );
    76   AddTestCase( re + ".global",
    77 	       g,
    78 	       re.global );
    80   AddTestCase( re + ".ignoreCase",
    81 	       i,
    82 	       re.ignoreCase );
    84   AddTestCase( re + ".multiline",
    85 	       m,
    86 	       re.multiline);
    88   AddTestCase( re + ".lastIndex",
    89 	       l,
    90 	       re.lastIndex  );
    91 }

mercurial