js/src/tests/ecma_3/RegExp/regress-224676.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.

michael@0 1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
michael@0 2 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 3 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 5
michael@0 6 /*
michael@0 7 *
michael@0 8 * Date: 04 November 2003
michael@0 9 * SUMMARY: Testing regexps with various disjunction + character class patterns
michael@0 10 *
michael@0 11 * See http://bugzilla.mozilla.org/show_bug.cgi?id=224676
michael@0 12 *
michael@0 13 */
michael@0 14 //-----------------------------------------------------------------------------
michael@0 15 var i = 0;
michael@0 16 var BUGNUMBER = 224676;
michael@0 17 var summary = 'Regexps with various disjunction + character class patterns';
michael@0 18 var status = '';
michael@0 19 var statusmessages = new Array();
michael@0 20 var pattern = '';
michael@0 21 var patterns = new Array();
michael@0 22 var string = '';
michael@0 23 var strings = new Array();
michael@0 24 var actualmatch = '';
michael@0 25 var actualmatches = new Array();
michael@0 26 var expectedmatch = '';
michael@0 27 var expectedmatches = new Array();
michael@0 28
michael@0 29
michael@0 30 string = 'ZZZxZZZ';
michael@0 31 status = inSection(1);
michael@0 32 pattern = /[x]|x/;
michael@0 33 actualmatch = string.match(pattern);
michael@0 34 expectedmatch = Array('x');
michael@0 35 addThis();
michael@0 36
michael@0 37 status = inSection(2);
michael@0 38 pattern = /x|[x]/;
michael@0 39 actualmatch = string.match(pattern);
michael@0 40 expectedmatch = Array('x');
michael@0 41 addThis();
michael@0 42
michael@0 43
michael@0 44 string = 'ZZZxbZZZ';
michael@0 45 status = inSection(3);
michael@0 46 pattern = /a|[x]b/;
michael@0 47 actualmatch = string.match(pattern);
michael@0 48 expectedmatch = Array('xb');
michael@0 49 addThis();
michael@0 50
michael@0 51 status = inSection(4);
michael@0 52 pattern = /[x]b|a/;
michael@0 53 actualmatch = string.match(pattern);
michael@0 54 expectedmatch = Array('xb');
michael@0 55 addThis();
michael@0 56
michael@0 57 status = inSection(5);
michael@0 58 pattern = /([x]b|a)/;
michael@0 59 actualmatch = string.match(pattern);
michael@0 60 expectedmatch = Array('xb', 'xb');
michael@0 61 addThis();
michael@0 62
michael@0 63 status = inSection(6);
michael@0 64 pattern = /([x]b|a)|a/;
michael@0 65 actualmatch = string.match(pattern);
michael@0 66 expectedmatch = Array('xb', 'xb');
michael@0 67 addThis();
michael@0 68
michael@0 69 status = inSection(7);
michael@0 70 pattern = /^[x]b|a/;
michael@0 71 actualmatch = string.match(pattern);
michael@0 72 expectedmatch = null;
michael@0 73 addThis();
michael@0 74
michael@0 75
michael@0 76 string = 'xb';
michael@0 77 status = inSection(8);
michael@0 78 pattern = /^[x]b|a/;
michael@0 79 actualmatch = string.match(pattern);
michael@0 80 expectedmatch = Array('xb');
michael@0 81 addThis();
michael@0 82
michael@0 83
michael@0 84 string = 'ZZZxbZZZ';
michael@0 85 status = inSection(9);
michael@0 86 pattern = /([x]b)|a/;
michael@0 87 actualmatch = string.match(pattern);
michael@0 88 expectedmatch = Array('xb', 'xb');
michael@0 89 addThis();
michael@0 90
michael@0 91 status = inSection(10);
michael@0 92 pattern = /()[x]b|a/;
michael@0 93 actualmatch = string.match(pattern);
michael@0 94 expectedmatch = Array('xb', '');
michael@0 95 addThis();
michael@0 96
michael@0 97 status = inSection(11);
michael@0 98 pattern = /x[b]|a/;
michael@0 99 actualmatch = string.match(pattern);
michael@0 100 expectedmatch = Array('xb');
michael@0 101 addThis();
michael@0 102
michael@0 103 status = inSection(12);
michael@0 104 pattern = /[x]{1}b|a/;
michael@0 105 actualmatch = string.match(pattern);
michael@0 106 expectedmatch = Array('xb');
michael@0 107 addThis();
michael@0 108
michael@0 109 status = inSection(13);
michael@0 110 pattern = /[x]b|a|a/;
michael@0 111 actualmatch = string.match(pattern);
michael@0 112 expectedmatch = Array('xb');
michael@0 113 addThis();
michael@0 114
michael@0 115 status = inSection(14);
michael@0 116 pattern = /[x]b|[a]/;
michael@0 117 actualmatch = string.match(pattern);
michael@0 118 expectedmatch = Array('xb');
michael@0 119 addThis();
michael@0 120
michael@0 121 status = inSection(15);
michael@0 122 pattern = /[x]b|a+/;
michael@0 123 actualmatch = string.match(pattern);
michael@0 124 expectedmatch = Array('xb');
michael@0 125 addThis();
michael@0 126
michael@0 127 status = inSection(16);
michael@0 128 pattern = /[x]b|a{1}/;
michael@0 129 actualmatch = string.match(pattern);
michael@0 130 expectedmatch = Array('xb');
michael@0 131 addThis();
michael@0 132
michael@0 133 status = inSection(17);
michael@0 134 pattern = /[x]b|(a)/;
michael@0 135 actualmatch = string.match(pattern);
michael@0 136 expectedmatch = Array('xb', undefined);
michael@0 137 addThis();
michael@0 138
michael@0 139 status = inSection(18);
michael@0 140 pattern = /[x]b|()a/;
michael@0 141 actualmatch = string.match(pattern);
michael@0 142 expectedmatch = Array('xb', undefined);
michael@0 143 addThis();
michael@0 144
michael@0 145 status = inSection(19);
michael@0 146 pattern = /[x]b|^a/;
michael@0 147 actualmatch = string.match(pattern);
michael@0 148 expectedmatch = Array('xb');
michael@0 149 addThis();
michael@0 150
michael@0 151 status = inSection(20);
michael@0 152 pattern = /a|[^b]b/;
michael@0 153 actualmatch = string.match(pattern);
michael@0 154 expectedmatch = Array('xb');
michael@0 155 addThis();
michael@0 156
michael@0 157 status = inSection(21);
michael@0 158 pattern = /a|[^b]{1}b/;
michael@0 159 actualmatch = string.match(pattern);
michael@0 160 expectedmatch = Array('xb');
michael@0 161 addThis();
michael@0 162
michael@0 163
michael@0 164 string = 'hallo\";';
michael@0 165 status = inSection(22);
michael@0 166 pattern = /^((\\[^\x00-\x1f]|[^\x00-\x1f"\\])*)"/;
michael@0 167 actualmatch = string.match(pattern);
michael@0 168 expectedmatch = Array('hallo"', 'hallo', 'o');
michael@0 169 addThis();
michael@0 170
michael@0 171 //----------------------------------------------------------------------------
michael@0 172 test();
michael@0 173 //----------------------------------------------------------------------------
michael@0 174
michael@0 175 function addThis()
michael@0 176 {
michael@0 177 statusmessages[i] = status;
michael@0 178 patterns[i] = pattern;
michael@0 179 strings[i] = string;
michael@0 180 actualmatches[i] = actualmatch;
michael@0 181 expectedmatches[i] = expectedmatch;
michael@0 182 i++;
michael@0 183 }
michael@0 184
michael@0 185 function test()
michael@0 186 {
michael@0 187 enterFunc ('test');
michael@0 188 printBugNumber(BUGNUMBER);
michael@0 189 printStatus (summary);
michael@0 190 testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches);
michael@0 191 exitFunc ('test');
michael@0 192 }

mercurial