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 | * Test that when we add 2 breakpoints to the same line at different columns and |
michael@0 | 6 | * then remove one of them, we don't remove them both. |
michael@0 | 7 | */ |
michael@0 | 8 | |
michael@0 | 9 | var gDebuggee; |
michael@0 | 10 | var gClient; |
michael@0 | 11 | var gThreadClient; |
michael@0 | 12 | |
michael@0 | 13 | function run_test() |
michael@0 | 14 | { |
michael@0 | 15 | initTestDebuggerServer(); |
michael@0 | 16 | gDebuggee = addTestGlobal("test-breakpoints"); |
michael@0 | 17 | gClient = new DebuggerClient(DebuggerServer.connectPipe()); |
michael@0 | 18 | gClient.connect(function() { |
michael@0 | 19 | attachTestTabAndResume(gClient, "test-breakpoints", function(aResponse, aTabClient, aThreadClient) { |
michael@0 | 20 | gThreadClient = aThreadClient; |
michael@0 | 21 | test_breakpoints_columns(); |
michael@0 | 22 | }); |
michael@0 | 23 | }); |
michael@0 | 24 | do_test_pending(); |
michael@0 | 25 | } |
michael@0 | 26 | |
michael@0 | 27 | const URL = "http://example.com/benderbendingrodriguez.js"; |
michael@0 | 28 | |
michael@0 | 29 | const code = |
michael@0 | 30 | "(" + function (global) { |
michael@0 | 31 | global.foo = function () { |
michael@0 | 32 | Math.abs(-1); Math.log(0.5); |
michael@0 | 33 | debugger; |
michael@0 | 34 | }; |
michael@0 | 35 | debugger; |
michael@0 | 36 | } + "(this))"; |
michael@0 | 37 | |
michael@0 | 38 | const firstLocation = { |
michael@0 | 39 | url: URL, |
michael@0 | 40 | line: 3, |
michael@0 | 41 | column: 4 |
michael@0 | 42 | }; |
michael@0 | 43 | |
michael@0 | 44 | const secondLocation = { |
michael@0 | 45 | url: URL, |
michael@0 | 46 | line: 3, |
michael@0 | 47 | column: 18 |
michael@0 | 48 | }; |
michael@0 | 49 | |
michael@0 | 50 | function test_breakpoints_columns() { |
michael@0 | 51 | gClient.addOneTimeListener("paused", set_breakpoints); |
michael@0 | 52 | |
michael@0 | 53 | Components.utils.evalInSandbox(code, gDebuggee, "1.8", URL, 1); |
michael@0 | 54 | } |
michael@0 | 55 | |
michael@0 | 56 | function set_breakpoints() { |
michael@0 | 57 | let first, second; |
michael@0 | 58 | |
michael@0 | 59 | gThreadClient.setBreakpoint(firstLocation, function ({ error, actualLocation }, |
michael@0 | 60 | aBreakpointClient) { |
michael@0 | 61 | do_check_true(!error, "Should not get an error setting the breakpoint"); |
michael@0 | 62 | do_check_true(!actualLocation, "Should not get an actualLocation"); |
michael@0 | 63 | first = aBreakpointClient; |
michael@0 | 64 | |
michael@0 | 65 | gThreadClient.setBreakpoint(secondLocation, function ({ error, actualLocation }, |
michael@0 | 66 | aBreakpointClient) { |
michael@0 | 67 | do_check_true(!error, "Should not get an error setting the breakpoint"); |
michael@0 | 68 | do_check_true(!actualLocation, "Should not get an actualLocation"); |
michael@0 | 69 | second = aBreakpointClient; |
michael@0 | 70 | |
michael@0 | 71 | test_different_actors(first, second); |
michael@0 | 72 | }); |
michael@0 | 73 | }); |
michael@0 | 74 | } |
michael@0 | 75 | |
michael@0 | 76 | function test_different_actors(aFirst, aSecond) { |
michael@0 | 77 | do_check_neq(aFirst.actor, aSecond.actor, |
michael@0 | 78 | "Each breakpoint should have a different actor"); |
michael@0 | 79 | test_remove_one(aFirst, aSecond); |
michael@0 | 80 | } |
michael@0 | 81 | |
michael@0 | 82 | function test_remove_one(aFirst, aSecond) { |
michael@0 | 83 | aFirst.remove(function ({error}) { |
michael@0 | 84 | do_check_true(!error, "Should not get an error removing a breakpoint"); |
michael@0 | 85 | |
michael@0 | 86 | let hitSecond; |
michael@0 | 87 | gClient.addListener("paused", function _onPaused(aEvent, {why, frame}) { |
michael@0 | 88 | if (why.type == "breakpoint") { |
michael@0 | 89 | hitSecond = true; |
michael@0 | 90 | do_check_eq(why.actors.length, 1, |
michael@0 | 91 | "Should only be paused because of one breakpoint actor"); |
michael@0 | 92 | do_check_eq(why.actors[0], aSecond.actor, |
michael@0 | 93 | "Should be paused because of the correct breakpoint actor"); |
michael@0 | 94 | do_check_eq(frame.where.line, secondLocation.line, |
michael@0 | 95 | "Should be at the right line"); |
michael@0 | 96 | do_check_eq(frame.where.column, secondLocation.column, |
michael@0 | 97 | "Should be at the right column"); |
michael@0 | 98 | gThreadClient.resume(); |
michael@0 | 99 | return; |
michael@0 | 100 | } |
michael@0 | 101 | |
michael@0 | 102 | if (why.type == "debuggerStatement") { |
michael@0 | 103 | gClient.removeListener("paused", _onPaused); |
michael@0 | 104 | do_check_true(hitSecond, |
michael@0 | 105 | "We should still hit `second`, but not `first`."); |
michael@0 | 106 | |
michael@0 | 107 | finishClient(gClient); |
michael@0 | 108 | return; |
michael@0 | 109 | } |
michael@0 | 110 | |
michael@0 | 111 | do_check_true(false, "Should never get here"); |
michael@0 | 112 | }); |
michael@0 | 113 | |
michael@0 | 114 | gThreadClient.resume(() => gDebuggee.foo()); |
michael@0 | 115 | }); |
michael@0 | 116 | } |