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