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 we don't stop at debugger statements inside black boxed sources. |
michael@0 | 6 | */ |
michael@0 | 7 | |
michael@0 | 8 | var gDebuggee; |
michael@0 | 9 | var gClient; |
michael@0 | 10 | var gThreadClient; |
michael@0 | 11 | var gBpClient; |
michael@0 | 12 | |
michael@0 | 13 | function run_test() |
michael@0 | 14 | { |
michael@0 | 15 | initTestDebuggerServer(); |
michael@0 | 16 | gDebuggee = addTestGlobal("test-black-box"); |
michael@0 | 17 | gClient = new DebuggerClient(DebuggerServer.connectPipe()); |
michael@0 | 18 | gClient.connect(function() { |
michael@0 | 19 | attachTestTabAndResume(gClient, "test-black-box", function(aResponse, aTabClient, aThreadClient) { |
michael@0 | 20 | gThreadClient = aThreadClient; |
michael@0 | 21 | test_black_box(); |
michael@0 | 22 | }); |
michael@0 | 23 | }); |
michael@0 | 24 | do_test_pending(); |
michael@0 | 25 | } |
michael@0 | 26 | |
michael@0 | 27 | const BLACK_BOXED_URL = "http://example.com/blackboxme.js"; |
michael@0 | 28 | const SOURCE_URL = "http://example.com/source.js"; |
michael@0 | 29 | |
michael@0 | 30 | function test_black_box() |
michael@0 | 31 | { |
michael@0 | 32 | gClient.addOneTimeListener("paused", function () { |
michael@0 | 33 | gThreadClient.setBreakpoint({ |
michael@0 | 34 | url: SOURCE_URL, |
michael@0 | 35 | line: 4 |
michael@0 | 36 | }, function ({error}, bpClient) { |
michael@0 | 37 | gBpClient = bpClient; |
michael@0 | 38 | do_check_true(!error, "Should not get an error: " + error); |
michael@0 | 39 | gThreadClient.resume(test_black_box_dbg_statement); |
michael@0 | 40 | }); |
michael@0 | 41 | }); |
michael@0 | 42 | |
michael@0 | 43 | Components.utils.evalInSandbox( |
michael@0 | 44 | "" + function doStuff(k) { // line 1 |
michael@0 | 45 | debugger; // line 2 - Break here |
michael@0 | 46 | k(100); // line 3 |
michael@0 | 47 | }, // line 4 |
michael@0 | 48 | gDebuggee, |
michael@0 | 49 | "1.8", |
michael@0 | 50 | BLACK_BOXED_URL, |
michael@0 | 51 | 1 |
michael@0 | 52 | ); |
michael@0 | 53 | |
michael@0 | 54 | Components.utils.evalInSandbox( |
michael@0 | 55 | "" + function runTest() { // line 1 |
michael@0 | 56 | doStuff( // line 2 |
michael@0 | 57 | function (n) { // line 3 |
michael@0 | 58 | Math.abs(n); // line 4 - Break here |
michael@0 | 59 | } // line 5 |
michael@0 | 60 | ); // line 6 |
michael@0 | 61 | } // line 7 |
michael@0 | 62 | + "\n debugger;", // line 8 |
michael@0 | 63 | gDebuggee, |
michael@0 | 64 | "1.8", |
michael@0 | 65 | SOURCE_URL, |
michael@0 | 66 | 1 |
michael@0 | 67 | ); |
michael@0 | 68 | } |
michael@0 | 69 | |
michael@0 | 70 | function test_black_box_dbg_statement() { |
michael@0 | 71 | gThreadClient.getSources(function ({error, sources}) { |
michael@0 | 72 | do_check_true(!error, "Should not get an error: " + error); |
michael@0 | 73 | let sourceClient = gThreadClient.source(sources.filter(s => s.url == BLACK_BOXED_URL)[0]); |
michael@0 | 74 | |
michael@0 | 75 | sourceClient.blackBox(function ({error}) { |
michael@0 | 76 | do_check_true(!error, "Should not get an error: " + error); |
michael@0 | 77 | |
michael@0 | 78 | gClient.addOneTimeListener("paused", function (aEvent, aPacket) { |
michael@0 | 79 | do_check_eq(aPacket.why.type, "breakpoint", |
michael@0 | 80 | "We should pass over the debugger statement."); |
michael@0 | 81 | gBpClient.remove(function ({error}) { |
michael@0 | 82 | do_check_true(!error, "Should not get an error: " + error); |
michael@0 | 83 | gThreadClient.resume(test_unblack_box_dbg_statement.bind(null, sourceClient)); |
michael@0 | 84 | }); |
michael@0 | 85 | }); |
michael@0 | 86 | gDebuggee.runTest(); |
michael@0 | 87 | }); |
michael@0 | 88 | }); |
michael@0 | 89 | } |
michael@0 | 90 | |
michael@0 | 91 | function test_unblack_box_dbg_statement(aSourceClient) { |
michael@0 | 92 | aSourceClient.unblackBox(function ({error}) { |
michael@0 | 93 | do_check_true(!error, "Should not get an error: " + error); |
michael@0 | 94 | |
michael@0 | 95 | gClient.addOneTimeListener("paused", function (aEvent, aPacket) { |
michael@0 | 96 | do_check_eq(aPacket.why.type, "debuggerStatement", |
michael@0 | 97 | "We should stop at the debugger statement again"); |
michael@0 | 98 | finishClient(gClient); |
michael@0 | 99 | }); |
michael@0 | 100 | gDebuggee.runTest(); |
michael@0 | 101 | }); |
michael@0 | 102 | } |