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 // Debugger.prototype.findScripts can filter scripts by URL.
2 var g1 = newGlobal();
3 var g2 = newGlobal();
4 var g3 = newGlobal();
6 // Define some functions whose url will be this test file.
7 g1.eval('function g1f() {}');
8 g2.eval('function g2f() {}');
10 // Define some functions whose url will be a different file.
11 url2 = scriptdir + "Debugger-findScripts-08-script2";
12 load(url2);
14 var dbg = new Debugger();
15 var g1w = dbg.addDebuggee(g1);
16 var g2w = dbg.addDebuggee(g2);
17 var g3w = dbg.addDebuggee(g3);
19 var g1fw = g1w.makeDebuggeeValue(g1.g1f);
20 var g1gw = g1w.makeDebuggeeValue(g1.g1g);
21 var g2fw = g2w.makeDebuggeeValue(g2.g2f);
22 var g2gw = g2w.makeDebuggeeValue(g2.g2g);
24 // Find the url of this file.
25 url = g1fw.script.url;
27 var scripts;
29 scripts = dbg.findScripts({});
30 assertEq(scripts.indexOf(g1fw.script) != -1, true);
31 assertEq(scripts.indexOf(g1gw.script) != -1, true);
32 assertEq(scripts.indexOf(g2fw.script) != -1, true);
33 assertEq(scripts.indexOf(g2gw.script) != -1, true);
35 scripts = dbg.findScripts({url:url});
36 assertEq(scripts.indexOf(g1fw.script) != -1, true);
37 assertEq(scripts.indexOf(g1gw.script) != -1, false);
38 assertEq(scripts.indexOf(g2fw.script) != -1, true);
39 assertEq(scripts.indexOf(g2gw.script) != -1, false);
41 scripts = dbg.findScripts({url:url2});
42 assertEq(scripts.indexOf(g1fw.script) != -1, false);
43 assertEq(scripts.indexOf(g1gw.script) != -1, true);
44 assertEq(scripts.indexOf(g2fw.script) != -1, false);
45 assertEq(scripts.indexOf(g2gw.script) != -1, true);
47 scripts = dbg.findScripts({url:url, global:g1});
48 assertEq(scripts.indexOf(g1fw.script) != -1, true);
49 assertEq(scripts.indexOf(g1gw.script) != -1, false);
50 assertEq(scripts.indexOf(g2fw.script) != -1, false);
51 assertEq(scripts.indexOf(g2gw.script) != -1, false);
53 scripts = dbg.findScripts({url:url2, global:g1});
54 assertEq(scripts.indexOf(g1fw.script) != -1, false);
55 assertEq(scripts.indexOf(g1gw.script) != -1, true);
56 assertEq(scripts.indexOf(g2fw.script) != -1, false);
57 assertEq(scripts.indexOf(g2gw.script) != -1, false);
59 scripts = dbg.findScripts({url:url, global:g2});
60 assertEq(scripts.indexOf(g1fw.script) != -1, false);
61 assertEq(scripts.indexOf(g1gw.script) != -1, false);
62 assertEq(scripts.indexOf(g2fw.script) != -1, true);
63 assertEq(scripts.indexOf(g2gw.script) != -1, false);
65 scripts = dbg.findScripts({url:url2, global:g2});
66 assertEq(scripts.indexOf(g1fw.script) != -1, false);
67 assertEq(scripts.indexOf(g1gw.script) != -1, false);
68 assertEq(scripts.indexOf(g2fw.script) != -1, false);
69 assertEq(scripts.indexOf(g2gw.script) != -1, true);
71 scripts = dbg.findScripts({url:"xlerb"}); // "XLERB"???
72 assertEq(scripts.indexOf(g1fw.script) != -1, false);
73 assertEq(scripts.indexOf(g1gw.script) != -1, false);
74 assertEq(scripts.indexOf(g2fw.script) != -1, false);
75 assertEq(scripts.indexOf(g2gw.script) != -1, false);
77 scripts = dbg.findScripts({url:url, global:g3});
78 assertEq(scripts.indexOf(g1fw.script) != -1, false);
79 assertEq(scripts.indexOf(g1gw.script) != -1, false);
80 assertEq(scripts.indexOf(g2fw.script) != -1, false);
81 assertEq(scripts.indexOf(g2gw.script) != -1, false);