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 AsyncShutdown report errors correctly
6 function setup_crash() {
7 Components.utils.import("resource://gre/modules/AsyncShutdown.jsm", this);
8 Components.utils.import("resource://gre/modules/Services.jsm", this);
9 Components.utils.import("resource://gre/modules/Promise.jsm", this);
11 Services.prefs.setBoolPref("toolkit.asyncshutdown.testing", true);
12 Services.prefs.setIntPref("toolkit.asyncshutdown.crash_timeout", 10);
14 let TOPIC = "testing-async-shutdown-crash";
15 let phase = AsyncShutdown._getPhase(TOPIC);
16 phase.addBlocker("A blocker that is never satisfied", function() {
17 dump("Installing blocker\n");
18 let deferred = Promise.defer();
19 return deferred.promise;
20 });
22 Services.obs.notifyObservers(null, TOPIC, null);
23 dump("Waiting for crash\n");
24 }
26 function after_crash(mdump, extra) {
27 do_print("after crash: " + extra.AsyncShutdownTimeout);
28 let info = JSON.parse(extra.AsyncShutdownTimeout);
29 do_check_eq(info.phase, "testing-async-shutdown-crash");
30 do_print("Condition: " + JSON.stringify(info.conditions));
31 do_check_true(JSON.stringify(info.conditions).indexOf("A blocker that is never satisfied") != -1);
32 }
34 // Test that AsyncShutdown + OS.File reports errors correctly, in a case in which
35 // the latest operation succeeded
37 function setup_osfile_crash_noerror() {
38 Components.utils.import("resource://gre/modules/Services.jsm", this);
39 Components.utils.import("resource://gre/modules/osfile.jsm", this);
41 Services.prefs.setBoolPref("toolkit.osfile.debug.failshutdown", true);
42 Services.prefs.setIntPref("toolkit.asyncshutdown.crash_timeout", 1);
43 Services.prefs.setBoolPref("toolkit.osfile.native", false);
45 OS.File.getCurrentDirectory();
46 Services.obs.notifyObservers(null, "profile-before-change", null);
47 dump("Waiting for crash\n");
48 };
50 function after_osfile_crash_noerror(mdump, extra) {
51 do_print("after OS.File crash: " + JSON.stringify(extra.AsyncShutdownTimeout));
52 let info = JSON.parse(extra.AsyncShutdownTimeout);
53 let state = info.conditions[0].state;
54 do_print("Keys: " + Object.keys(state).join(", "));
55 do_check_eq(info.phase, "profile-before-change");
56 do_check_true(state.launched);
57 do_check_false(state.shutdown);
58 do_check_true(state.worker);
59 do_check_true(!!state.latestSent);
60 do_check_eq(state.latestSent[1], "getCurrentDirectory");
61 }
63 // Test that AsyncShutdown + OS.File reports errors correctly, in a case in which
64 // the latest operation failed
66 function setup_osfile_crash_exn() {
67 Components.utils.import("resource://gre/modules/Services.jsm", this);
68 Components.utils.import("resource://gre/modules/osfile.jsm", this);
70 Services.prefs.setBoolPref("toolkit.osfile.debug.failshutdown", true);
71 Services.prefs.setIntPref("toolkit.asyncshutdown.crash_timeout", 1);
72 Services.prefs.setBoolPref("toolkit.osfile.native", false);
74 OS.File.read("I do not exist");
75 Services.obs.notifyObservers(null, "profile-before-change", null);
76 dump("Waiting for crash\n");
77 };
79 function after_osfile_crash_exn(mdump, extra) {
80 do_print("after OS.File crash: " + JSON.stringify(extra.AsyncShutdownTimeout));
81 let info = JSON.parse(extra.AsyncShutdownTimeout);
82 let state = info.conditions[0].state;
83 do_print("Keys: " + Object.keys(state).join(", "));
84 do_check_eq(info.phase, "profile-before-change");
85 do_check_false(state.shutdown);
86 do_check_true(state.worker);
87 do_check_true(!!state.latestSent);
88 do_check_eq(state.latestSent[1], "read");
89 }
91 function run_test() {
92 do_crash(setup_crash, after_crash);
93 do_crash(setup_osfile_crash_noerror, after_osfile_crash_noerror);
94 do_crash(setup_osfile_crash_exn, after_osfile_crash_exn);
95 }