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 | /* Any copyright is dedicated to the Public Domain. |
michael@0 | 2 | http://creativecommons.org/publicdomain/zero/1.0/ */ |
michael@0 | 3 | |
michael@0 | 4 | Cu.import("resource://gre/modules/devtools/dbg-server.jsm"); |
michael@0 | 5 | Cu.import("resource://gre/modules/devtools/dbg-client.jsm"); |
michael@0 | 6 | |
michael@0 | 7 | var gClient; |
michael@0 | 8 | var gTabClient; |
michael@0 | 9 | var gDebuggee; |
michael@0 | 10 | |
michael@0 | 11 | function run_test() |
michael@0 | 12 | { |
michael@0 | 13 | initTestDebuggerServer(); |
michael@0 | 14 | gDebuggee = testGlobal("test-1"); |
michael@0 | 15 | DebuggerServer.addTestGlobal(gDebuggee); |
michael@0 | 16 | |
michael@0 | 17 | let transport = DebuggerServer.connectPipe(); |
michael@0 | 18 | gClient = new DebuggerClient(transport); |
michael@0 | 19 | gClient.connect(function(aType, aTraits) { |
michael@0 | 20 | attachTestTab(gClient, "test-1", function(aReply, aTabClient) { |
michael@0 | 21 | gTabClient = aTabClient; |
michael@0 | 22 | test_threadAttach(aReply.threadActor); |
michael@0 | 23 | }); |
michael@0 | 24 | }); |
michael@0 | 25 | do_test_pending(); |
michael@0 | 26 | } |
michael@0 | 27 | |
michael@0 | 28 | function test_threadAttach(aThreadActorID) |
michael@0 | 29 | { |
michael@0 | 30 | do_print("Trying to attach to thread " + aThreadActorID); |
michael@0 | 31 | gTabClient.attachThread({}, function(aResponse, aThreadClient) { |
michael@0 | 32 | do_check_eq(aThreadClient.state, "paused"); |
michael@0 | 33 | do_check_eq(aThreadClient.actor, aThreadActorID); |
michael@0 | 34 | aThreadClient.resume(function() { |
michael@0 | 35 | do_check_eq(aThreadClient.state, "attached"); |
michael@0 | 36 | test_debugger_statement(aThreadClient); |
michael@0 | 37 | }); |
michael@0 | 38 | }); |
michael@0 | 39 | } |
michael@0 | 40 | |
michael@0 | 41 | function test_debugger_statement(aThreadClient) |
michael@0 | 42 | { |
michael@0 | 43 | aThreadClient.addListener("paused", function(aEvent, aPacket) { |
michael@0 | 44 | do_check_eq(aThreadClient.state, "paused"); |
michael@0 | 45 | // Reach around the protocol to check that the debuggee is in the state |
michael@0 | 46 | // we expect. |
michael@0 | 47 | do_check_true(gDebuggee.a); |
michael@0 | 48 | do_check_false(gDebuggee.b); |
michael@0 | 49 | |
michael@0 | 50 | let xpcInspector = Cc["@mozilla.org/jsinspector;1"].getService(Ci.nsIJSInspector); |
michael@0 | 51 | do_check_eq(xpcInspector.eventLoopNestLevel, 1); |
michael@0 | 52 | |
michael@0 | 53 | aThreadClient.resume(cleanup); |
michael@0 | 54 | }); |
michael@0 | 55 | |
michael@0 | 56 | Cu.evalInSandbox("var a = true; var b = false; debugger; var b = true;", gDebuggee); |
michael@0 | 57 | |
michael@0 | 58 | // Now make sure that we've run the code after the debugger statement... |
michael@0 | 59 | do_check_true(gDebuggee.b); |
michael@0 | 60 | } |
michael@0 | 61 | |
michael@0 | 62 | function cleanup() |
michael@0 | 63 | { |
michael@0 | 64 | gClient.addListener("closed", function(aEvent) { |
michael@0 | 65 | do_test_finished(); |
michael@0 | 66 | }); |
michael@0 | 67 | |
michael@0 | 68 | try { |
michael@0 | 69 | let xpcInspector = Cc["@mozilla.org/jsinspector;1"].getService(Ci.nsIJSInspector); |
michael@0 | 70 | do_check_eq(xpcInspector.eventLoopNestLevel, 0); |
michael@0 | 71 | } catch(e) { |
michael@0 | 72 | dump(e); |
michael@0 | 73 | } |
michael@0 | 74 | |
michael@0 | 75 | gClient.close(); |
michael@0 | 76 | } |