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 can black box source mapped sources.
6 */
8 var gDebuggee;
9 var gClient;
10 var gThreadClient;
12 Components.utils.import('resource:///modules/devtools/SourceMap.jsm');
14 function run_test()
15 {
16 initTestDebuggerServer();
17 gDebuggee = addTestGlobal("test-black-box");
18 gClient = new DebuggerClient(DebuggerServer.connectPipe());
19 gClient.connect(function() {
20 attachTestTabAndResume(gClient, "test-black-box", function(aResponse, aTabClient, aThreadClient) {
21 gThreadClient = aThreadClient;
23 promise.resolve(setup_code())
24 .then(black_box_code)
25 .then(run_code)
26 .then(test_correct_location)
27 .then(null, function (error) {
28 do_check_true(false, "Should not get an error, got " + error);
29 })
30 .then(function () {
31 finishClient(gClient);
32 });
33 });
34 });
35 do_test_pending();
36 }
38 function setup_code() {
39 let { code, map } = (new SourceNode(null, null, null, [
40 new SourceNode(1, 0, "a.js", "" + function a() {
41 return b();
42 }),
43 "\n",
44 new SourceNode(1, 0, "b.js", "" + function b() {
45 debugger; // Don't want to stop here.
46 return c();
47 }),
48 "\n",
49 new SourceNode(1, 0, "c.js", "" + function c() {
50 debugger; // Want to stop here.
51 }),
52 "\n"
53 ])).toStringWithSourceMap({
54 file: "abc.js",
55 sourceRoot: "http://example.com/"
56 });
58 code += "//# sourceMappingURL=data:text/json," + map.toString();
60 Components.utils.evalInSandbox(code,
61 gDebuggee,
62 "1.8",
63 "http://example.com/abc.js");
64 }
66 function black_box_code() {
67 const d = promise.defer();
69 gThreadClient.getSources(function ({ sources, error }) {
70 do_check_true(!error, "Shouldn't get an error getting sources");
71 const source = sources.filter((s) => {
72 return s.url.indexOf("b.js") !== -1;
73 })[0];
74 do_check_true(!!source, "We should have our source in the sources list");
76 gThreadClient.source(source).blackBox(function ({ error }) {
77 do_check_true(!error, "Should not get an error black boxing");
78 d.resolve(true);
79 });
80 });
82 return d.promise;
83 }
85 function run_code() {
86 const d = promise.defer();
88 gClient.addOneTimeListener("paused", function (aEvent, aPacket) {
89 d.resolve(aPacket);
90 gThreadClient.resume();
91 });
92 gDebuggee.a();
94 return d.promise;
95 }
97 function test_correct_location(aPacket) {
98 do_check_eq(aPacket.why.type, "debuggerStatement",
99 "Should hit a debugger statement.");
100 do_check_eq(aPacket.frame.where.url, "http://example.com/c.js",
101 "Should have skipped over the debugger statement in the black boxed source");
102 }