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