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 | function testAddInconvertibleObjectInconvertibleObject() |
michael@0 | 2 | { |
michael@0 | 3 | var count1 = 0; |
michael@0 | 4 | function toString1() { ++count1; if (count1 == 95) return {}; return "" + count1; } |
michael@0 | 5 | var o1 = {valueOf: undefined, toString: toString1}; |
michael@0 | 6 | var count2 = 0; |
michael@0 | 7 | function toString2() { ++count2; if (count2 == 95) return {}; return "" + count2; } |
michael@0 | 8 | var o2 = {valueOf: undefined, toString: toString2}; |
michael@0 | 9 | |
michael@0 | 10 | var threw = false; |
michael@0 | 11 | try |
michael@0 | 12 | { |
michael@0 | 13 | for (var i = 0; i < 100; i++) |
michael@0 | 14 | var q = o1 + o2; |
michael@0 | 15 | } |
michael@0 | 16 | catch (e) |
michael@0 | 17 | { |
michael@0 | 18 | threw = true; |
michael@0 | 19 | if (i !== 94) |
michael@0 | 20 | return "expected i === 94, got " + i; |
michael@0 | 21 | if (q !== "9494") |
michael@0 | 22 | return "expected q === '9494', got " + q + " (type " + typeof q + ")"; |
michael@0 | 23 | if (count1 !== 95) |
michael@0 | 24 | return "expected count1 === 95, got " + count1; |
michael@0 | 25 | if (count2 !== 94) |
michael@0 | 26 | return "expected count2 === 94, got " + count2; |
michael@0 | 27 | } |
michael@0 | 28 | if (!threw) |
michael@0 | 29 | return "expected throw with o1 + o2"; |
michael@0 | 30 | |
michael@0 | 31 | return "pass"; |
michael@0 | 32 | } |
michael@0 | 33 | assertEq(testAddInconvertibleObjectInconvertibleObject(), "pass"); |