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 | "use strict"; |
michael@0 | 5 | |
michael@0 | 6 | const Profiler = Cc["@mozilla.org/tools/profiler;1"].getService(Ci.nsIProfiler); |
michael@0 | 7 | |
michael@0 | 8 | function connectClient(callback) { |
michael@0 | 9 | let client = new DebuggerClient(DebuggerServer.connectPipe()); |
michael@0 | 10 | client.connect(function () { |
michael@0 | 11 | client.listTabs(function(response) { |
michael@0 | 12 | callback(client, response.profilerActor); |
michael@0 | 13 | }); |
michael@0 | 14 | }); |
michael@0 | 15 | } |
michael@0 | 16 | |
michael@0 | 17 | function run_test() |
michael@0 | 18 | { |
michael@0 | 19 | // Ensure the profiler is not running when the test starts (it could |
michael@0 | 20 | // happen if the MOZ_PROFILER_STARTUP environment variable is set) |
michael@0 | 21 | Profiler.StopProfiler(); |
michael@0 | 22 | |
michael@0 | 23 | DebuggerServer.init(function () { return true; }); |
michael@0 | 24 | DebuggerServer.addBrowserActors(); |
michael@0 | 25 | |
michael@0 | 26 | connectClient((client1, actor1) => { |
michael@0 | 27 | connectClient((client2, actor2) => { |
michael@0 | 28 | activate_first(client1, actor1, client2, actor2); |
michael@0 | 29 | }); |
michael@0 | 30 | }) |
michael@0 | 31 | |
michael@0 | 32 | do_test_pending(); |
michael@0 | 33 | } |
michael@0 | 34 | |
michael@0 | 35 | function activate_first(client1, actor1, client2, actor2) { |
michael@0 | 36 | // Start the profiler on the first connection.... |
michael@0 | 37 | client1.request({ to: actor1, type: "startProfiler", features: ['js']}, startResponse => { |
michael@0 | 38 | // Profiler should be active now. |
michael@0 | 39 | do_check_true(Profiler.IsActive()); |
michael@0 | 40 | |
michael@0 | 41 | // But on the next connection just make sure the actor has been |
michael@0 | 42 | // instantiated. |
michael@0 | 43 | client2.request({ to: actor2, type: "getFeatures" }, featureResponse => { |
michael@0 | 44 | |
michael@0 | 45 | let connectionClosed = DebuggerServer._connectionClosed; |
michael@0 | 46 | DebuggerServer._connectionClosed = function(conn) { |
michael@0 | 47 | connectionClosed.call(this, conn); |
michael@0 | 48 | |
michael@0 | 49 | // Client1 is the only actor that started the profiler, |
michael@0 | 50 | // it shouldn't be active anymore. |
michael@0 | 51 | do_check_false(Profiler.IsActive()); |
michael@0 | 52 | |
michael@0 | 53 | DebuggerServer._connectionClosed = function(conn) { |
michael@0 | 54 | connectionClosed.call(this, conn); |
michael@0 | 55 | |
michael@0 | 56 | // Now there are no open clients at all, it should *definitely* |
michael@0 | 57 | // be deactivated by now. |
michael@0 | 58 | do_check_false(Profiler.IsActive()); |
michael@0 | 59 | do_test_finished(); |
michael@0 | 60 | } |
michael@0 | 61 | client2.close(); |
michael@0 | 62 | }; |
michael@0 | 63 | client1.close(); |
michael@0 | 64 | }); |
michael@0 | 65 | }); |
michael@0 | 66 | } |