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 permanently cache sources from source maps.
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-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 test_cached_original_sources();
23 });
24 });
25 do_test_pending();
26 }
28 function test_cached_original_sources()
29 {
30 writeFile("temp.js", "initial content");
32 gClient.addOneTimeListener("newSource", onNewSource);
34 let node = new SourceNode(1, 0,
35 getFileUrl("temp.js"),
36 "function funcFromTemp() {}\n");
37 let { code, map } = node.toStringWithSourceMap({
38 file: "abc.js"
39 });
40 code += "//# sourceMappingURL=data:text/json;base64," + btoa(map.toString());
43 Components.utils.evalInSandbox(code, gDebuggee, "1.8",
44 "http://example.com/www/js/abc.js", 1);
45 }
47 function onNewSource(aEvent, aPacket) {
48 let sourceClient = gThreadClient.source(aPacket.source);
49 sourceClient.source(function (aResponse) {
50 do_check_true(!aResponse.error,
51 "Should not be an error grabbing the source");
52 do_check_eq(aResponse.source, "initial content",
53 "The correct source content should be sent");
55 writeFile("temp.js", "new content");
57 sourceClient.source(function (aResponse) {
58 do_check_true(!aResponse.error,
59 "Should not be an error grabbing the source");
60 do_check_eq(aResponse.source, "new content",
61 "The correct source content should not be cached, so we should get the new content");
63 do_get_file("temp.js").remove(false);
64 finishClient(gClient);
65 });
66 });
67 }