Sat, 03 Jan 2015 20:18:00 +0100
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 // |reftest| skip -- Yarr doesn't bail on complex regexps.
2 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 //-----------------------------------------------------------------------------
8 var BUGNUMBER = 330569;
9 var summary = 'RegExp - throw InternalError on too complex regular expressions';
10 var actual = '';
11 var expect = '';
14 //-----------------------------------------------------------------------------
15 test();
16 //-----------------------------------------------------------------------------
18 function test()
19 {
20 enterFunc ('test');
21 printBugNumber(BUGNUMBER);
22 printStatus (summary);
24 var s;
25 expect = 'InternalError: regular expression too complex';
27 s = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">' +
28 '<html>\n' +
29 '<head>\n' +
30 '<meta http-equiv="content-type" content="text/html; charset=windows-1250">\n' +
31 '<meta name="generator" content="PSPad editor, www.pspad.com">\n' +
32 '<title></title>\n'+
33 '</head>\n' +
34 '<body>\n' +
35 '<!-- hello -->\n' +
36 '<script language="JavaScript">\n' +
37 'var s = document. body. innerHTML;\n' +
38 'var d = s. replace (/<!--(.*|\n)*-->/, "");\n' +
39 'alert (d);\n' +
40 '</script>\n' +
41 '</body>\n' +
42 '</html>\n';
44 try
45 {
46 /<!--(.*|\n)*-->/.exec(s);
47 }
48 catch(ex)
49 {
50 actual = ex + '';
51 }
53 reportCompare(expect, actual, summary + ': /<!--(.*|\\n)*-->/.exec(s)');
55 function testre( re, n ) {
56 for ( var i= 0; i <= n; ++i ) {
57 re.test( Array( i+1 ).join() );
58 }
59 }
61 try
62 {
63 testre( /(?:,*)*x/, 22 );
64 }
65 catch(ex)
66 {
67 actual = ex + '';
68 }
70 reportCompare(expect, actual, summary + ': testre( /(?:,*)*x/, 22 )');
72 try
73 {
74 testre( /(?:,|,)*x/, 22 );
75 }
76 catch(ex)
77 {
78 actual = ex + '';
79 }
81 reportCompare(expect, actual, summary + ': testre( /(?:,|,)*x/, 22 )');
83 try
84 {
85 testre( /(?:,|,|,|,|,)*x/, 10 );
86 }
87 catch(ex)
88 {
89 actual = ex + '';
90 }
91 reportCompare(expect, actual, summary + ': testre( /(?:,|,|,|,|,)*x/, 10 )');
93 exitFunc ('test');
94 }