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 /* -*- 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 *
8 * Date: 12 Feb 2002
9 * SUMMARY: Don't crash on invalid regexp literals / \\/ /
10 *
11 * See http://bugzilla.mozilla.org/show_bug.cgi?id=122076
12 * The function checkURL() below sometimes caused a compile-time error:
13 *
14 * SyntaxError: unterminated parenthetical (:
15 *
16 * However, sometimes it would cause a crash instead. The presence of
17 * other functions below is merely fodder to help provoke the crash.
18 * The constant |STRESS| is number of times we'll try to crash on this.
19 *
20 */
21 //-----------------------------------------------------------------------------
22 var BUGNUMBER = 122076;
23 var summary = "Don't crash on invalid regexp literals / \\/ /";
24 var STRESS = 10;
25 var sEval = '';
27 printBugNumber(BUGNUMBER);
28 printStatus(summary);
31 sEval += 'function checkDate()'
32 sEval += '{'
33 sEval += 'return (this.value.search(/^[012]?\d\/[0123]?\d\/[0]\d$/) != -1);'
34 sEval += '}'
36 sEval += 'function checkDNSName()'
37 sEval += '{'
38 sEval += ' return (this.value.search(/^([\w\-]+\.)+([\w\-]{2,3})$/) != -1);'
39 sEval += '}'
41 sEval += 'function checkEmail()'
42 sEval += '{'
43 sEval += ' return (this.value.search(/^([\w\-]+\.)*[\w\-]+@([\w\-]+\.)+([\w\-]{2,3})$/) != -1);'
44 sEval += '}'
46 sEval += 'function checkHostOrIP()'
47 sEval += '{'
48 sEval += ' if (this.value.search(/^([\w\-]+\.)+([\w\-]{2,3})$/) == -1)'
49 sEval += ' return (this.value.search(/^[1-2]?\d{1,2}\.[1-2]?\d{1,2}\.[1-2]?\d{1,2}\.[1-2]?\d{1,2}$/) != -1);'
50 sEval += ' else'
51 sEval += ' return true;'
52 sEval += '}'
54 sEval += 'function checkIPAddress()'
55 sEval += '{'
56 sEval += ' return (this.value.search(/^[1-2]?\d{1,2}\.[1-2]?\d{1,2}\.[1-2]?\d{1,2}\.[1-2]?\d{1,2}$/) != -1);'
57 sEval += '}'
59 sEval += 'function checkURL()'
60 sEval += '{'
61 sEval += ' return (this.value.search(/^(((https?)|(ftp)):\/\/([\-\w]+\.)+\w{2,4}(\/[%\-\w]+(\.\w{2,})?)*(([\w\-\.\?\\/\*\$+@&#;`~=%!]*)(\.\w{2,})?)*\/?)$/) != -1);'
62 sEval += '}'
65 for (var i=0; i<STRESS; i++)
66 {
67 try
68 {
69 eval(sEval);
70 }
71 catch(e)
72 {
73 }
74 }
76 reportCompare('No Crash', 'No Crash', '');