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 | <!DOCTYPE HTML> |
michael@0 | 2 | <html lang="en"> |
michael@0 | 3 | <head> |
michael@0 | 4 | <meta charset="utf8"> |
michael@0 | 5 | <title>Basic Web Console Actor tests</title> |
michael@0 | 6 | <script type="text/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> |
michael@0 | 7 | <script type="text/javascript;version=1.8" src="common.js"></script> |
michael@0 | 8 | <!-- Any copyright is dedicated to the Public Domain. |
michael@0 | 9 | - http://creativecommons.org/publicdomain/zero/1.0/ --> |
michael@0 | 10 | </head> |
michael@0 | 11 | <body> |
michael@0 | 12 | <p>Basic Web Console Actor tests</p> |
michael@0 | 13 | |
michael@0 | 14 | <script class="testbody" type="text/javascript;version=1.8"> |
michael@0 | 15 | SimpleTest.waitForExplicitFinish(); |
michael@0 | 16 | |
michael@0 | 17 | function startTest() |
michael@0 | 18 | { |
michael@0 | 19 | removeEventListener("load", startTest); |
michael@0 | 20 | |
michael@0 | 21 | attachConsole(["PageError"], onStartPageError); |
michael@0 | 22 | } |
michael@0 | 23 | |
michael@0 | 24 | function onStartPageError(aState, aResponse) |
michael@0 | 25 | { |
michael@0 | 26 | is(aResponse.startedListeners.length, 1, "startedListeners.length"); |
michael@0 | 27 | is(aResponse.startedListeners[0], "PageError", "startedListeners: PageError"); |
michael@0 | 28 | ok(aResponse.nativeConsoleAPI, "nativeConsoleAPI"); |
michael@0 | 29 | |
michael@0 | 30 | closeDebugger(aState, function() { |
michael@0 | 31 | top.console_ = top.console; |
michael@0 | 32 | top.console = { lolz: "foo" }; |
michael@0 | 33 | attachConsole(["PageError", "ConsoleAPI", "foo"], |
michael@0 | 34 | onStartPageErrorAndConsoleAPI, true); |
michael@0 | 35 | }); |
michael@0 | 36 | } |
michael@0 | 37 | |
michael@0 | 38 | function onStartPageErrorAndConsoleAPI(aState, aResponse) |
michael@0 | 39 | { |
michael@0 | 40 | let startedListeners = aResponse.startedListeners; |
michael@0 | 41 | is(startedListeners.length, 2, "startedListeners.length"); |
michael@0 | 42 | isnot(startedListeners.indexOf("PageError"), -1, "startedListeners: PageError"); |
michael@0 | 43 | isnot(startedListeners.indexOf("ConsoleAPI"), -1, |
michael@0 | 44 | "startedListeners: ConsoleAPI"); |
michael@0 | 45 | is(startedListeners.indexOf("foo"), -1, "startedListeners: no foo"); |
michael@0 | 46 | ok(!aResponse.nativeConsoleAPI, "!nativeConsoleAPI"); |
michael@0 | 47 | |
michael@0 | 48 | aState.client.stopListeners(["ConsoleAPI", "foo"], |
michael@0 | 49 | onStopConsoleAPI.bind(null, aState)); |
michael@0 | 50 | } |
michael@0 | 51 | |
michael@0 | 52 | function onStopConsoleAPI(aState, aResponse) |
michael@0 | 53 | { |
michael@0 | 54 | is(aResponse.stoppedListeners.length, 1, "stoppedListeners.length"); |
michael@0 | 55 | is(aResponse.stoppedListeners[0], "ConsoleAPI", "stoppedListeners: ConsoleAPI"); |
michael@0 | 56 | |
michael@0 | 57 | closeDebugger(aState, function() { |
michael@0 | 58 | attachConsole(["ConsoleAPI"], onStartConsoleAPI); |
michael@0 | 59 | }); |
michael@0 | 60 | } |
michael@0 | 61 | |
michael@0 | 62 | function onStartConsoleAPI(aState, aResponse) |
michael@0 | 63 | { |
michael@0 | 64 | is(aResponse.startedListeners.length, 1, "startedListeners.length"); |
michael@0 | 65 | is(aResponse.startedListeners[0], "ConsoleAPI", "startedListeners: ConsoleAPI"); |
michael@0 | 66 | ok(aResponse.nativeConsoleAPI, "nativeConsoleAPI"); |
michael@0 | 67 | |
michael@0 | 68 | top.console = top.console_; |
michael@0 | 69 | delete top.console_; |
michael@0 | 70 | |
michael@0 | 71 | closeDebugger(aState, function() { |
michael@0 | 72 | SimpleTest.finish(); |
michael@0 | 73 | }); |
michael@0 | 74 | } |
michael@0 | 75 | |
michael@0 | 76 | addEventListener("load", startTest); |
michael@0 | 77 | </script> |
michael@0 | 78 | </body> |
michael@0 | 79 | </html> |