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 | var gClient; |
michael@0 | 5 | var gActors; |
michael@0 | 6 | |
michael@0 | 7 | /** |
michael@0 | 8 | * The purpose of these tests is to verify that it's possible to add actors |
michael@0 | 9 | * both before and after the DebuggerServer has been initialized, so addons |
michael@0 | 10 | * that add actors don't have to poll the object for its initialization state |
michael@0 | 11 | * in order to add actors after initialization but rather can add actors anytime |
michael@0 | 12 | * regardless of the object's state. |
michael@0 | 13 | */ |
michael@0 | 14 | function run_test() |
michael@0 | 15 | { |
michael@0 | 16 | DebuggerServer.addActors("resource://test/pre_init_global_actors.js"); |
michael@0 | 17 | DebuggerServer.addActors("resource://test/pre_init_tab_actors.js"); |
michael@0 | 18 | |
michael@0 | 19 | DebuggerServer.init(function () { return true; }); |
michael@0 | 20 | DebuggerServer.addBrowserActors(); |
michael@0 | 21 | |
michael@0 | 22 | DebuggerServer.addActors("resource://test/post_init_global_actors.js"); |
michael@0 | 23 | DebuggerServer.addActors("resource://test/post_init_tab_actors.js"); |
michael@0 | 24 | |
michael@0 | 25 | add_test(init); |
michael@0 | 26 | add_test(test_pre_init_global_actor); |
michael@0 | 27 | add_test(test_pre_init_tab_actor); |
michael@0 | 28 | add_test(test_post_init_global_actor); |
michael@0 | 29 | add_test(test_post_init_tab_actor); |
michael@0 | 30 | add_test(test_stable_global_actor_instances); |
michael@0 | 31 | add_test(close_client); |
michael@0 | 32 | run_next_test(); |
michael@0 | 33 | } |
michael@0 | 34 | |
michael@0 | 35 | function init() |
michael@0 | 36 | { |
michael@0 | 37 | gClient = new DebuggerClient(DebuggerServer.connectPipe()); |
michael@0 | 38 | gClient.connect(function onConnect() { |
michael@0 | 39 | gClient.listTabs(function onListTabs(aResponse) { |
michael@0 | 40 | gActors = aResponse; |
michael@0 | 41 | run_next_test(); |
michael@0 | 42 | }); |
michael@0 | 43 | }); |
michael@0 | 44 | } |
michael@0 | 45 | |
michael@0 | 46 | function test_pre_init_global_actor() |
michael@0 | 47 | { |
michael@0 | 48 | gClient.request({ to: gActors.preInitGlobalActor, type: "ping" }, |
michael@0 | 49 | function onResponse(aResponse) { |
michael@0 | 50 | do_check_eq(aResponse.message, "pong"); |
michael@0 | 51 | run_next_test(); |
michael@0 | 52 | } |
michael@0 | 53 | ); |
michael@0 | 54 | } |
michael@0 | 55 | |
michael@0 | 56 | function test_pre_init_tab_actor() |
michael@0 | 57 | { |
michael@0 | 58 | gClient.request({ to: gActors.preInitTabActor, type: "ping" }, |
michael@0 | 59 | function onResponse(aResponse) { |
michael@0 | 60 | do_check_eq(aResponse.message, "pong"); |
michael@0 | 61 | run_next_test(); |
michael@0 | 62 | } |
michael@0 | 63 | ); |
michael@0 | 64 | } |
michael@0 | 65 | |
michael@0 | 66 | function test_post_init_global_actor() |
michael@0 | 67 | { |
michael@0 | 68 | gClient.request({ to: gActors.postInitGlobalActor, type: "ping" }, |
michael@0 | 69 | function onResponse(aResponse) { |
michael@0 | 70 | do_check_eq(aResponse.message, "pong"); |
michael@0 | 71 | run_next_test(); |
michael@0 | 72 | } |
michael@0 | 73 | ); |
michael@0 | 74 | } |
michael@0 | 75 | |
michael@0 | 76 | function test_post_init_tab_actor() |
michael@0 | 77 | { |
michael@0 | 78 | gClient.request({ to: gActors.postInitTabActor, type: "ping" }, |
michael@0 | 79 | function onResponse(aResponse) { |
michael@0 | 80 | do_check_eq(aResponse.message, "pong"); |
michael@0 | 81 | run_next_test(); |
michael@0 | 82 | } |
michael@0 | 83 | ); |
michael@0 | 84 | } |
michael@0 | 85 | |
michael@0 | 86 | // Get the object object, from the server side, for a given actor ID |
michael@0 | 87 | function getActorInstance(connID, actorID) { |
michael@0 | 88 | return DebuggerServer._connections[connID].getActor(actorID); |
michael@0 | 89 | } |
michael@0 | 90 | |
michael@0 | 91 | function test_stable_global_actor_instances() |
michael@0 | 92 | { |
michael@0 | 93 | // Consider that there is only one connection, |
michael@0 | 94 | // and the first one is ours |
michael@0 | 95 | let connID = Object.keys(DebuggerServer._connections)[0]; |
michael@0 | 96 | let postInitGlobalActor = getActorInstance(connID, gActors.postInitGlobalActor); |
michael@0 | 97 | let preInitGlobalActor = getActorInstance(connID, gActors.preInitGlobalActor); |
michael@0 | 98 | gClient.listTabs(function onListTabs(aResponse) { |
michael@0 | 99 | do_check_eq(postInitGlobalActor, getActorInstance(connID, aResponse.postInitGlobalActor)); |
michael@0 | 100 | do_check_eq(preInitGlobalActor, getActorInstance(connID, aResponse.preInitGlobalActor)); |
michael@0 | 101 | run_next_test(); |
michael@0 | 102 | }); |
michael@0 | 103 | } |
michael@0 | 104 | |
michael@0 | 105 | function close_client() { |
michael@0 | 106 | gClient.close(() => run_next_test()); |
michael@0 | 107 | } |