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 the basic functionality of the nsIJSInspector component.
5 var gCount = 0;
6 const MAX = 10;
7 var inspector = Cc["@mozilla.org/jsinspector;1"].getService(Ci.nsIJSInspector);
8 var tm = Cc["@mozilla.org/thread-manager;1"].getService(Ci.nsIThreadManager);
10 // Emulate 10 simultaneously-debugged windows from 3 separate client connections.
11 var requestor = (count) => ({
12 url:"http://foo/bar/" + count,
13 connection: "conn" + (count % 3)
14 });
16 function run_test()
17 {
18 test_nesting();
19 }
21 function test_nesting()
22 {
23 do_check_eq(inspector.eventLoopNestLevel, 0);
25 tm.currentThread.dispatch({ run: enterEventLoop}, 0);
27 do_check_eq(inspector.enterNestedEventLoop(requestor(gCount)), 0);
28 do_check_eq(inspector.eventLoopNestLevel, 0);
29 do_check_eq(inspector.lastNestRequestor, null);
30 }
32 function enterEventLoop() {
33 if (gCount++ < MAX) {
34 tm.currentThread.dispatch({ run: enterEventLoop}, 0);
36 let r = Object.create(requestor(gCount));
38 do_check_eq(inspector.eventLoopNestLevel, gCount);
39 do_check_eq(inspector.lastNestRequestor.url, requestor(gCount - 1).url);
40 do_check_eq(inspector.lastNestRequestor.connection, requestor(gCount - 1).connection);
41 do_check_eq(inspector.enterNestedEventLoop(requestor(gCount)), gCount);
42 } else {
43 do_check_eq(gCount, MAX + 1);
44 tm.currentThread.dispatch({ run: exitEventLoop}, 0);
45 }
46 }
48 function exitEventLoop() {
49 if (inspector.lastNestRequestor != null) {
50 do_check_eq(inspector.lastNestRequestor.url, requestor(gCount - 1).url);
51 do_check_eq(inspector.lastNestRequestor.connection, requestor(gCount - 1).connection);
52 if (gCount-- > 1) {
53 tm.currentThread.dispatch({ run: exitEventLoop}, 0);
54 }
56 do_check_eq(inspector.exitNestedEventLoop(), gCount);
57 do_check_eq(inspector.eventLoopNestLevel, gCount);
58 }
59 }