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.
1 /* -*- Mode: javascript; js-indent-level: 2; -*- */
2 /* Any copyright is dedicated to the Public Domain.
3 http://creativecommons.org/publicdomain/zero/1.0/ */
5 // Test that we can nest event loops and then automatically exit nested event
6 // loops when requested.
8 var gClient;
9 var gThreadActor;
11 function run_test() {
12 initTestDebuggerServer();
13 let gDebuggee = addTestGlobal("test-nesting");
14 gClient = new DebuggerClient(DebuggerServer.connectPipe());
15 gClient.connect(function () {
16 attachTestTabAndResume(gClient, "test-nesting", function (aResponse, aTabClient, aThreadClient) {
17 // Reach over the protocol connection and get a reference to the thread actor.
18 gThreadActor = aThreadClient._transport._serverConnection.getActor(aThreadClient._actor);
20 test_nesting();
21 });
22 });
23 do_test_pending();
24 }
26 function test_nesting() {
27 const thread = gThreadActor;
28 const { resolve, reject, promise: p } = promise.defer();
30 // The following things should happen (in order):
31 // 1. In the new event loop (created by synchronize)
32 // 2. Resolve the promise (shouldn't exit any event loops)
33 // 3. Exit the event loop (should also then exit synchronize's event loop)
34 // 4. Be after the synchronize call
35 let currentStep = 0;
37 executeSoon(function () {
38 let eventLoop;
40 executeSoon(function () {
41 // Should be at step 2
42 do_check_eq(++currentStep, 2);
43 // Before resolving, should have the synchronize event loop and the one just created.
44 do_check_eq(thread._nestedEventLoops.size, 2);
46 executeSoon(function () {
47 // Should be at step 3
48 do_check_eq(++currentStep, 3);
49 // Before exiting the manually created event loop, should have the
50 // synchronize event loop and the manual event loop.
51 do_check_eq(thread._nestedEventLoops.size, 2);
52 // Should have the event loop
53 do_check_true(!!eventLoop);
54 eventLoop.resolve();
55 });
57 resolve(true);
58 // Shouldn't exit any event loops because a new one started since the call to synchronize
59 do_check_eq(thread._nestedEventLoops.size, 2);
60 });
62 // Should be at step 1
63 do_check_eq(++currentStep, 1);
64 // Should have only the synchronize event loop
65 do_check_eq(thread._nestedEventLoops.size, 1);
66 eventLoop = thread._nestedEventLoops.push();
67 eventLoop.enter();
68 });
70 do_check_eq(thread.synchronize(p), true);
72 // Should be on the fourth step
73 do_check_eq(++currentStep, 4);
74 // There shouldn't be any nested event loops anymore
75 do_check_eq(thread._nestedEventLoops.size, 0);
77 finishClient(gClient);
78 }