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 stepping out of a function returns the right return value.
6 */
8 var gDebuggee;
9 var gClient;
10 var gThreadClient;
12 function run_test()
13 {
14 initTestDebuggerServer();
15 gDebuggee = addTestGlobal("test-stack");
16 gClient = new DebuggerClient(DebuggerServer.connectPipe());
17 gClient.connect(function () {
18 attachTestTabAndResume(gClient, "test-stack", function (aResponse, aTabClient, aThreadClient) {
19 gThreadClient = aThreadClient;
20 // XXX: We have to do an executeSoon so that the error isn't caught and
21 // reported by DebuggerClient.requester (because we are using the local
22 // transport and share a stack) which causes the test to fail.
23 Services.tm.mainThread.dispatch({
24 run: test_simple_stepping
25 }, Ci.nsIThread.DISPATCH_NORMAL);
26 });
27 });
28 do_test_pending();
29 }
31 function test_simple_stepping()
32 {
33 gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) {
34 gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) {
35 // Check that the return value is 10.
36 do_check_eq(aPacket.type, "paused");
37 do_check_eq(aPacket.frame.where.line, gDebuggee.line0 + 4);
38 do_check_eq(aPacket.why.type, "resumeLimit");
39 do_check_eq(aPacket.why.frameFinished.return, 10);
41 gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) {
42 gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) {
43 // Check that the return value is undefined.
44 do_check_eq(aPacket.type, "paused");
45 do_check_eq(aPacket.frame.where.line, gDebuggee.line0 + 7);
46 do_check_eq(aPacket.why.type, "resumeLimit");
47 do_check_eq(aPacket.why.frameFinished.return.type, "undefined");
49 gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) {
50 gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) {
51 // Check that the exception was thrown.
52 do_check_eq(aPacket.type, "paused");
53 do_check_eq(aPacket.frame.where.line, gDebuggee.line0 + 12);
54 do_check_eq(aPacket.why.type, "resumeLimit");
55 do_check_eq(aPacket.why.frameFinished.throw, "ah");
57 gThreadClient.resume(function () {
58 finishClient(gClient);
59 });
60 });
61 gThreadClient.stepOut();
62 });
63 gThreadClient.resume();
64 });
65 gThreadClient.stepOut();
66 });
67 gThreadClient.resume();
68 });
69 gThreadClient.stepOut();
71 });
73 gDebuggee.eval("var line0 = Error().lineNumber;\n" +
74 "function f() {\n" + // line0 + 1
75 " debugger;\n" + // line0 + 2
76 " var a = 10;\n" + // line0 + 3
77 " return a;\n" + // line0 + 4
78 "}\n" + // line0 + 5
79 "function g() {\n" + // line0 + 6
80 " debugger;\n" + // line0 + 7
81 "}\n" + // line0 + 8
82 "function h() {\n" + // line0 + 9
83 " debugger;\n" + // line0 + 10
84 " throw 'ah';\n" + // line0 + 11
85 " return 2;\n" + // line0 + 12
86 "}\n" + // line0 + 13
87 "f();\n" + // line0 + 14
88 "g();\n" + // line0 + 15
89 "try { h() } catch (ex) { };\n"); // line0 + 16
90 }