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 the exit frame packets get the correct `why` value. |
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_exit_frame_whys(); |
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_exit_frame_whys() |
michael@0 | 29 | { |
michael@0 | 30 | gClient.addListener("traces", (aEvent, { traces }) => { |
michael@0 | 31 | for (let t of traces) { |
michael@0 | 32 | if (t.type == "exitedFrame") { |
michael@0 | 33 | check_trace(t); |
michael@0 | 34 | } |
michael@0 | 35 | } |
michael@0 | 36 | }); |
michael@0 | 37 | |
michael@0 | 38 | start_trace() |
michael@0 | 39 | .then(eval_code) |
michael@0 | 40 | .then(stop_trace) |
michael@0 | 41 | .then(function() { |
michael@0 | 42 | finishClient(gClient); |
michael@0 | 43 | }).then(null, error => { |
michael@0 | 44 | do_check_true(false, "Should not get an error, got: " + error); |
michael@0 | 45 | }); |
michael@0 | 46 | } |
michael@0 | 47 | |
michael@0 | 48 | function start_trace() |
michael@0 | 49 | { |
michael@0 | 50 | let deferred = promise.defer(); |
michael@0 | 51 | gTraceClient.startTrace(["name"], null, function() { deferred.resolve(); }); |
michael@0 | 52 | return deferred.promise; |
michael@0 | 53 | } |
michael@0 | 54 | |
michael@0 | 55 | function eval_code() |
michael@0 | 56 | { |
michael@0 | 57 | gDebuggee.eval("(" + function() { |
michael@0 | 58 | function thrower() { |
michael@0 | 59 | throw new Error(); |
michael@0 | 60 | } |
michael@0 | 61 | |
michael@0 | 62 | function* yielder() { |
michael@0 | 63 | yield 1; |
michael@0 | 64 | } |
michael@0 | 65 | |
michael@0 | 66 | function returner() { |
michael@0 | 67 | return 1; |
michael@0 | 68 | } |
michael@0 | 69 | |
michael@0 | 70 | try { |
michael@0 | 71 | thrower(); |
michael@0 | 72 | } catch(e) {} |
michael@0 | 73 | |
michael@0 | 74 | // XXX bug 923729: Can't test yielding yet. |
michael@0 | 75 | // for (let x of yielder()) { |
michael@0 | 76 | // break; |
michael@0 | 77 | // } |
michael@0 | 78 | |
michael@0 | 79 | returner(); |
michael@0 | 80 | } + ")()"); |
michael@0 | 81 | } |
michael@0 | 82 | |
michael@0 | 83 | function stop_trace() |
michael@0 | 84 | { |
michael@0 | 85 | let deferred = promise.defer(); |
michael@0 | 86 | gTraceClient.stopTrace(null, function() { deferred.resolve(); }); |
michael@0 | 87 | return deferred.promise; |
michael@0 | 88 | } |
michael@0 | 89 | |
michael@0 | 90 | function check_trace(aEvent, { sequence, why }) |
michael@0 | 91 | { |
michael@0 | 92 | switch(sequence) { |
michael@0 | 93 | case 3: |
michael@0 | 94 | do_check_eq(why, "throw"); |
michael@0 | 95 | break; |
michael@0 | 96 | case 5: |
michael@0 | 97 | do_check_eq(why, "return"); |
michael@0 | 98 | break; |
michael@0 | 99 | } |
michael@0 | 100 | } |