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 | * Check that we only break on offsets that are entry points for the line we are |
michael@0 | 6 | * breaking on. Bug 907278. |
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 | gDebuggee.console = { log: x => void x }; |
michael@0 | 18 | gClient = new DebuggerClient(DebuggerServer.connectPipe()); |
michael@0 | 19 | gClient.connect(function () { |
michael@0 | 20 | attachTestTabAndResume(gClient, |
michael@0 | 21 | "test-breakpoints", |
michael@0 | 22 | function (aResponse, aTabClient, aThreadClient) { |
michael@0 | 23 | gThreadClient = aThreadClient; |
michael@0 | 24 | setUpCode(); |
michael@0 | 25 | }); |
michael@0 | 26 | }); |
michael@0 | 27 | do_test_pending(); |
michael@0 | 28 | } |
michael@0 | 29 | |
michael@0 | 30 | const URL = "test.js"; |
michael@0 | 31 | |
michael@0 | 32 | function setUpCode() { |
michael@0 | 33 | gClient.addOneTimeListener("newSource", setBreakpoint); |
michael@0 | 34 | Cu.evalInSandbox( |
michael@0 | 35 | "" + function test() { |
michael@0 | 36 | console.log("foo bar"); |
michael@0 | 37 | debugger; |
michael@0 | 38 | }, |
michael@0 | 39 | gDebuggee, |
michael@0 | 40 | "1.8", |
michael@0 | 41 | URL |
michael@0 | 42 | ); |
michael@0 | 43 | } |
michael@0 | 44 | |
michael@0 | 45 | function setBreakpoint() { |
michael@0 | 46 | gClient.addOneTimeListener("resumed", runCode); |
michael@0 | 47 | gThreadClient.setBreakpoint({ |
michael@0 | 48 | url: URL, |
michael@0 | 49 | line: 1 |
michael@0 | 50 | }, ({ error }) => { |
michael@0 | 51 | do_check_true(!error); |
michael@0 | 52 | }); |
michael@0 | 53 | } |
michael@0 | 54 | |
michael@0 | 55 | function runCode() { |
michael@0 | 56 | gClient.addOneTimeListener("paused", testBPHit); |
michael@0 | 57 | gDebuggee.test(); |
michael@0 | 58 | } |
michael@0 | 59 | |
michael@0 | 60 | function testBPHit(event, { why }) { |
michael@0 | 61 | do_check_eq(why.type, "breakpoint"); |
michael@0 | 62 | gClient.addOneTimeListener("paused", testDbgStatement); |
michael@0 | 63 | gThreadClient.resume(); |
michael@0 | 64 | } |
michael@0 | 65 | |
michael@0 | 66 | function testDbgStatement(event, { why }) { |
michael@0 | 67 | // Should continue to the debugger statement. |
michael@0 | 68 | do_check_eq(why.type, "debuggerStatement"); |
michael@0 | 69 | // Not break on another offset from the same line (that isn't an entry point |
michael@0 | 70 | // to the line) |
michael@0 | 71 | do_check_neq(why.type, "breakpoint"); |
michael@0 | 72 | finishClient(gClient); |
michael@0 | 73 | } |