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