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/
3 */
5 function run_test() {
6 setupTestCommon();
8 logTestInfo("testing download a complete on partial failure. Calling " +
9 "nsIUpdatePrompt::showUpdateError should call getNewPrompter " +
10 "and alert on the object returned by getNewPrompter when the " +
11 "update.state == " + STATE_FAILED + " and the update.errorCode " +
12 "== " + WRITE_ERROR + " (Bug 595059).");
14 Services.prefs.setBoolPref(PREF_APP_UPDATE_SILENT, false);
16 let registrar = Components.manager.QueryInterface(AUS_Ci.nsIComponentRegistrar);
17 registrar.registerFactory(Components.ID("{1dfeb90a-2193-45d5-9cb8-864928b2af55}"),
18 "Fake Window Watcher",
19 "@mozilla.org/embedcomp/window-watcher;1",
20 WindowWatcherFactory);
22 standardInit();
24 writeUpdatesToXMLFile(getLocalUpdatesXMLString(""), false);
25 let url = URL_HOST + "/" + FILE_COMPLETE_MAR;
26 let patches = getLocalPatchString("complete", url, null, null, null, null,
27 STATE_FAILED);
28 let updates = getLocalUpdateString(patches, null, null, "version 1.0", "1.0",
29 null, null, null, null, url);
30 writeUpdatesToXMLFile(getLocalUpdatesXMLString(updates), true);
31 writeStatusFile(STATE_FAILED);
33 reloadUpdateManagerData();
35 let update = gUpdateManager.activeUpdate;
36 update.errorCode = WRITE_ERROR;
37 let prompter = AUS_Cc["@mozilla.org/updates/update-prompt;1"].
38 createInstance(AUS_Ci.nsIUpdatePrompt);
39 prompter.showUpdateError(update);
40 }
42 function end_test() {
43 let registrar = Components.manager.QueryInterface(AUS_Ci.nsIComponentRegistrar);
44 registrar.unregisterFactory(Components.ID("{1dfeb90a-2193-45d5-9cb8-864928b2af55}"),
45 WindowWatcherFactory);
46 }
48 var WindowWatcher = {
49 getNewPrompter: function(aParent) {
50 do_check_eq(aParent, null);
51 return {
52 alert: function(aTitle, aText) {
53 let title = getString("updaterIOErrorTitle");
54 do_check_eq(aTitle, title);
55 let text = gUpdateBundle.formatStringFromName("updaterIOErrorMsg",
56 [Services.appinfo.name,
57 Services.appinfo.name], 2);
58 do_check_eq(aText, text);
60 doTestFinish();
61 }
62 };
63 },
65 QueryInterface: function(iid) {
66 if (iid.equals(AUS_Ci.nsIWindowWatcher) ||
67 iid.equals(AUS_Ci.nsISupports))
68 return this;
70 throw AUS_Cr.NS_ERROR_NO_INTERFACE;
71 }
72 }
74 var WindowWatcherFactory = {
75 createInstance: function createInstance(outer, iid) {
76 if (outer != null)
77 throw AUS_Cr.NS_ERROR_NO_AGGREGATION;
78 return WindowWatcher.QueryInterface(iid);
79 }
80 };