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 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
3 * You can obtain one at http://mozilla.org/MPL/2.0/. */
5 const Cc = Components.classes;
6 const Ci = Components.interfaces;
8 Components.utils.import("resource://gre/modules/Services.jsm");
10 const manifest = do_get_file('bug725015.manifest');
11 const contract = "@bug725015.test.contract";
12 const observerTopic = "xpcom-category-entry-added";
13 const category = "bug725015-test-category";
14 const entry = "bug725015-category-entry";
15 const cid = Components.ID("{05070380-6e6e-42ba-aaa5-3289fc55ca5a}");
17 function observe_category(subj, topic, data) {
18 try {
19 do_check_eq(topic, observerTopic);
20 if (data != category)
21 return;
23 var thisentry = subj.QueryInterface(Ci.nsISupportsCString).data;
24 do_check_eq(thisentry, entry);
26 do_check_eq(Cc["@mozilla.org/categorymanager;1"].getService(Ci.nsICategoryManager).getCategoryEntry(category, entry), contract);
27 do_check_true(Cc[contract].equals(cid));
28 }
29 catch (e) {
30 do_throw(e);
31 }
32 do_test_finished();
33 }
35 function run_test() {
36 do_test_pending();
37 Services.obs.addObserver(observe_category, observerTopic, false);
38 Components.manager.QueryInterface(Ci.nsIComponentRegistrar).autoRegister(manifest);
39 }