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 | /* |
michael@0 | 2 | * Any copyright is dedicated to the Public Domain. |
michael@0 | 3 | * http://creativecommons.org/licenses/publicdomain/ |
michael@0 | 4 | * Contributor: Jason Orendorff <jorendorff@mozilla.com> |
michael@0 | 5 | */ |
michael@0 | 6 | |
michael@0 | 7 | // Decompile destructuring argument named `arguments` correctly. |
michael@0 | 8 | var actual = "" + function ([arguments]) {return arguments;}; |
michael@0 | 9 | compareSource('function ([arguments]) {return arguments;}', actual, "part 1"); |
michael@0 | 10 | |
michael@0 | 11 | // Make sure the 'arguments' argument actually works. |
michael@0 | 12 | var f = function ([arguments]) {return arguments + 1;}; |
michael@0 | 13 | reportCompare(3.25, f([2.25]), "part 2"); |
michael@0 | 14 | |
michael@0 | 15 | // Throw SyntaxError when `arguments` appears twice in a destructuring parameter. |
michael@0 | 16 | actual = "no exception"; |
michael@0 | 17 | try { |
michael@0 | 18 | eval('(function ([arguments, arguments]) {return arguments();})'); |
michael@0 | 19 | } catch (exc) { |
michael@0 | 20 | actual = exc.name; |
michael@0 | 21 | } |
michael@0 | 22 | reportCompare("SyntaxError", actual, "part 3"); |
michael@0 | 23 | |
michael@0 | 24 | // And again... |
michael@0 | 25 | actual = "no exception"; |
michael@0 | 26 | try { |
michael@0 | 27 | eval('(function ([a, b, arguments, d], [e, f, arguments]) {return arguments();})'); |
michael@0 | 28 | } catch (exc) { |
michael@0 | 29 | actual = exc.name; |
michael@0 | 30 | } |
michael@0 | 31 | reportCompare("SyntaxError", actual, "part 4"); |
michael@0 | 32 | |
michael@0 | 33 | // The original test case from bug 509354. Don't crash. |
michael@0 | 34 | try { |
michael@0 | 35 | eval('print(function([arguments,arguments,arguments,arguments,arguments,' + |
michael@0 | 36 | 'arguments,arguments,arguments,arguments,arguments,arguments,' + |
michael@0 | 37 | 'arguments,arguments,arguments,arguments,arguments]){})'); |
michael@0 | 38 | } catch (exc) { |
michael@0 | 39 | } |
michael@0 | 40 | reportCompare("no crash", "no crash", "part 5"); |
michael@0 | 41 |