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 * Check that we continue stepping when a single original source's line
6 * corresponds to multiple generated js lines.
7 */
9 var gDebuggee;
10 var gClient;
11 var gThreadClient;
13 Components.utils.import('resource:///modules/devtools/SourceMap.jsm');
15 function run_test() {
16 initTestDebuggerServer();
17 gDebuggee = addTestGlobal("test-source-map");
18 gClient = new DebuggerClient(DebuggerServer.connectPipe());
19 gClient.connect(function() {
20 attachTestTabAndResume(gClient, "test-source-map", function(aResponse, aTabClient, aThreadClient) {
21 gThreadClient = aThreadClient;
22 define_code();
23 });
24 });
25 do_test_pending();
26 }
28 function define_code() {
29 let { code, map } = (new SourceNode(null, null, null, [
30 new SourceNode(1, 0, "a.js", "function runTest() {\n"),
31 // A bunch of js lines map to the same original source line.
32 new SourceNode(2, 0, "a.js", " debugger;\n"),
33 new SourceNode(2, 0, "a.js", " var sum = 0;\n"),
34 new SourceNode(2, 0, "a.js", " for (var i = 0; i < 5; i++) {\n"),
35 new SourceNode(2, 0, "a.js", " sum += i;\n"),
36 new SourceNode(2, 0, "a.js", " }\n"),
37 // And now we have a new line in the original source that we should stop at.
38 new SourceNode(3, 0, "a.js", " sum;\n"),
39 new SourceNode(3, 0, "a.js", "}\n"),
40 ])).toStringWithSourceMap({
41 file: "abc.js",
42 sourceRoot: "http://example.com/"
43 });
45 code += "//# sourceMappingURL=data:text/json," + map.toString();
47 Components.utils.evalInSandbox(code, gDebuggee, "1.8",
48 "http://example.com/abc.js", 1);
50 run_code();
51 }
53 function run_code() {
54 gClient.addOneTimeListener("paused", function (aEvent, aPacket) {
55 do_check_eq(aPacket.why.type, "debuggerStatement");
56 step_in();
57 });
58 gDebuggee.runTest();
59 }
61 function step_in() {
62 gClient.addOneTimeListener("paused", function (aEvent, aPacket) {
63 do_check_eq(aPacket.why.type, "resumeLimit");
64 let { frame: { environment, where: { url, line } } } = aPacket;
65 // Stepping should have moved us to the next source mapped line.
66 do_check_eq(url, "http://example.com/a.js");
67 do_check_eq(line, 3);
68 // Which should have skipped over the for loop in the generated js and sum
69 // should be calculated.
70 do_check_eq(environment.bindings.variables.sum.value, 10);
71 finishClient(gClient);
72 });
73 gThreadClient.stepIn();
74 }