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 /* Any copyright is dedicated to the Public Domain.
2 http://creativecommons.org/publicdomain/zero/1.0/ */
4 /**
5 * Tests that automatically generated names for traces are unique.
6 */
8 var gDebuggee;
9 var gClient;
10 var gTraceClient;
12 function run_test()
13 {
14 initTestTracerServer();
15 gDebuggee = addTestGlobal("test-tracer-actor");
16 gClient = new DebuggerClient(DebuggerServer.connectPipe());
17 gClient.connect(function() {
18 attachTestTab(gClient, "test-tracer-actor", function(aResponse, aTabClient) {
19 gClient.attachTracer(aResponse.traceActor, function(aResponse, aTraceClient) {
20 gTraceClient = aTraceClient;
21 test_unique_generated_trace_names();
22 });
23 });
24 });
25 do_test_pending();
26 }
28 function test_unique_generated_trace_names()
29 {
30 let deferred = promise.defer();
31 deferred.resolve([]);
33 let p = deferred.promise, traces = 50;
34 for (let i = 0; i < traces; i++)
35 p = p.then(start_trace);
36 for (let i = 0; i < traces; i++)
37 p = p.then(stop_trace);
39 p = p.then(function() {
40 finishClient(gClient);
41 });
42 }
44 function start_trace(aTraceNames)
45 {
46 let deferred = promise.defer();
47 gTraceClient.startTrace([], null, function(aResponse) {
48 let hasDuplicates = aTraceNames.some(name => name === aResponse.name);
49 do_check_true(!hasDuplicates, "Generated trace names should be unique");
50 aTraceNames.push(aResponse.name);
51 deferred.resolve(aTraceNames);
52 });
53 return deferred.promise;
54 }
56 function stop_trace(aTraceNames)
57 {
58 let deferred = promise.defer();
59 gTraceClient.stopTrace(null, function(aResponse) {
60 do_check_eq(aTraceNames.pop(), aResponse.name,
61 "Stopped trace should be most recently started trace");
62 let hasDuplicates = aTraceNames.some(name => name === aResponse.name);
63 do_check_true(!hasDuplicates, "Generated trace names should be unique");
64 deferred.resolve(aTraceNames);
65 });
66 return deferred.promise;
67 }