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 // Test that ObjectClient.prototype.getDefinitionSite and the "definitionSite"
5 // request work properly.
7 var gDebuggee;
8 var gClient;
9 var gThreadClient;
11 function run_test()
12 {
13 initTestDebuggerServer();
14 gDebuggee = addTestGlobal("test-grips");
15 gDebuggee.eval(function stopMe() {
16 debugger;
17 }.toString());
19 gClient = new DebuggerClient(DebuggerServer.connectPipe());
20 gClient.connect(function() {
21 attachTestTabAndResume(gClient, "test-grips", function(aResponse, aTabClient, aThreadClient) {
22 gThreadClient = aThreadClient;
23 add_pause_listener();
24 });
25 });
26 do_test_pending();
27 }
29 function add_pause_listener()
30 {
31 gThreadClient.addOneTimeListener("paused", function(aEvent, aPacket) {
32 const [funcGrip, objGrip] = aPacket.frame.arguments;
33 const func = gThreadClient.pauseGrip(funcGrip);
34 const obj = gThreadClient.pauseGrip(objGrip);
35 test_definition_site(func, obj);
36 });
38 eval_code();
39 }
41 function eval_code() {
42 gDebuggee.eval([
43 "this.line0 = Error().lineNumber;",
44 "function f() {}",
45 "stopMe(f, {});"
46 ].join("\n"));
47 }
49 function test_definition_site(func, obj) {
50 func.getDefinitionSite(({ error, url, line, column }) => {
51 do_check_true(!error);
52 do_check_eq(url, getFilePath("test_objectgrips-13.js"));
53 do_check_eq(line, gDebuggee.line0 + 1);
54 do_check_eq(column, 0);
56 test_bad_definition_site(obj);
57 });
58 }
60 function test_bad_definition_site(obj) {
61 try {
62 obj._client.request("definitionSite", () => do_check_true(false));
63 } catch (e) {
64 gThreadClient.resume(() => finishClient(gClient));
65 }
66 }