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 var gDebuggee;
5 var gClient;
6 var gThreadClient;
8 function run_test()
9 {
10 initTestDebuggerServer();
11 gDebuggee = addTestGlobal("test-grips");
12 gDebuggee.eval(function stopMe(arg1) {
13 debugger;
14 }.toString());
16 gClient = new DebuggerClient(DebuggerServer.connectPipe());
17 gClient.connect(function() {
18 attachTestTabAndResume(gClient, "test-grips", function(aResponse, aTabClient, aThreadClient) {
19 gThreadClient = aThreadClient;
20 test_longstring_grip();
21 });
22 });
23 do_test_pending();
24 }
26 function test_longstring_grip()
27 {
28 let longString = "All I want is to be a monkey of moderate intelligence who"
29 + " wears a suit... that's why I'm transferring to business school! Maybe I"
30 + " love you so much, I love you no matter who you are pretending to be."
31 + " Enough about your promiscuous mother, Hermes! We have bigger problems."
32 + " For example, if you killed your grandfather, you'd cease to exist! What"
33 + " kind of a father would I be if I said no? Yep, I remember. They came in"
34 + " last at the Olympics, then retired to promote alcoholic beverages! And"
35 + " remember, don't do anything that affects anything, unless it turns out"
36 + " you were supposed to, in which case, for the love of God, don't not do"
37 + " it!";
39 DebuggerServer.LONG_STRING_LENGTH = 200;
41 gThreadClient.addOneTimeListener("paused", function(aEvent, aPacket) {
42 let args = aPacket.frame.arguments;
43 do_check_eq(args.length, 1);
44 let grip = args[0];
46 try {
47 do_check_eq(grip.type, "longString");
48 do_check_eq(grip.length, longString.length);
49 do_check_eq(grip.initial, longString.substr(0, DebuggerServer.LONG_STRING_INITIAL_LENGTH));
51 let longStringClient = gThreadClient.pauseLongString(grip);
52 longStringClient.substring(22, 28, function (aResponse) {
53 try {
54 do_check_eq(aResponse.substring, "monkey");
55 } finally {
56 gThreadClient.resume(function() {
57 finishClient(gClient);
58 });
59 }
60 });
61 } catch(error) {
62 gThreadClient.resume(function() {
63 finishClient(gClient);
64 do_throw(error);
65 });
66 }
67 });
69 gDebuggee.eval('stopMe("' + longString + '")');
70 }