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 | var global = this; |
michael@0 | 2 | function testWeirdDateParseOuter() |
michael@0 | 3 | { |
michael@0 | 4 | var vDateParts = ["11", "17", "2008"]; |
michael@0 | 5 | var out = []; |
michael@0 | 6 | for (var vI = 0; vI < vDateParts.length; vI++) |
michael@0 | 7 | out.push(testWeirdDateParseInner(vDateParts[vI])); |
michael@0 | 8 | /* Mutate the global shape so we fall off trace; this causes |
michael@0 | 9 | * additional oddity */ |
michael@0 | 10 | global.x = Math.random(); |
michael@0 | 11 | return out; |
michael@0 | 12 | } |
michael@0 | 13 | function testWeirdDateParseInner(pVal) |
michael@0 | 14 | { |
michael@0 | 15 | var vR = 0; |
michael@0 | 16 | for (var vI = 0; vI < pVal.length; vI++) { |
michael@0 | 17 | var vC = pVal.charAt(vI); |
michael@0 | 18 | if ((vC >= '0') && (vC <= '9')) |
michael@0 | 19 | vR = (vR * 10) + parseInt(vC); |
michael@0 | 20 | } |
michael@0 | 21 | return vR; |
michael@0 | 22 | } |
michael@0 | 23 | function testWeirdDateParse() { |
michael@0 | 24 | var result = []; |
michael@0 | 25 | result.push(testWeirdDateParseInner("11")); |
michael@0 | 26 | result.push(testWeirdDateParseInner("17")); |
michael@0 | 27 | result.push(testWeirdDateParseInner("2008")); |
michael@0 | 28 | result.push(testWeirdDateParseInner("11")); |
michael@0 | 29 | result.push(testWeirdDateParseInner("17")); |
michael@0 | 30 | result.push(testWeirdDateParseInner("2008")); |
michael@0 | 31 | result = result.concat(testWeirdDateParseOuter()); |
michael@0 | 32 | result = result.concat(testWeirdDateParseOuter()); |
michael@0 | 33 | result.push(testWeirdDateParseInner("11")); |
michael@0 | 34 | result.push(testWeirdDateParseInner("17")); |
michael@0 | 35 | result.push(testWeirdDateParseInner("2008")); |
michael@0 | 36 | return result.join(","); |
michael@0 | 37 | } |
michael@0 | 38 | assertEq(testWeirdDateParse(), "11,17,2008,11,17,2008,11,17,2008,11,17,2008,11,17,2008"); |