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