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
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
4 */
7 var MANIFESTS = [
8 do_get_file("data/test_bug380398.manifest")
9 ];
11 registerManifests(MANIFESTS);
13 var XULAppInfo = {
14 vendor: "Mozilla",
15 name: "XPCShell",
16 ID: "{39885e5f-f6b4-4e2a-87e5-6259ecf79011}",
17 version: "5",
18 appBuildID: "2007010101",
19 platformVersion: "1.9",
20 platformBuildID: "2007010101",
21 inSafeMode: false,
22 logConsoleErrors: true,
23 OS: "XPCShell",
24 XPCOMABI: "noarch-spidermonkey",
26 QueryInterface: function QueryInterface(iid) {
27 if (iid.equals(Ci.nsIXULAppInfo)
28 || iid.equals(Ci.nsIXULRuntime)
29 || iid.equals(Ci.nsISupports))
30 return this;
32 throw Components.results.NS_ERROR_NO_INTERFACE;
33 }
34 };
36 var XULAppInfoFactory = {
37 createInstance: function (outer, iid) {
38 if (outer != null)
39 throw Components.results.NS_ERROR_NO_AGGREGATION;
40 return XULAppInfo.QueryInterface(iid);
41 }
42 };
43 var registrar = Components.manager.QueryInterface(Ci.nsIComponentRegistrar);
44 registrar.registerFactory(XULAPPINFO_CID, "XULAppInfo",
45 XULAPPINFO_CONTRACTID, XULAppInfoFactory);
47 var gIOS = Cc["@mozilla.org/network/io-service;1"]
48 .getService(Ci.nsIIOService);
49 var chromeReg = Cc["@mozilla.org/chrome/chrome-registry;1"]
50 .getService(Ci.nsIChromeRegistry);
51 chromeReg.checkForNewChrome();
53 var target = gIOS.newFileURI(do_get_file("data"));
54 target = target.spec + "test/test.xul";
56 function test_succeeded_mapping(namespace)
57 {
58 var uri = gIOS.newURI("chrome://" + namespace + "/content/test.xul",
59 null, null);
60 try {
61 var result = chromeReg.convertChromeURL(uri);
62 do_check_eq(result.spec, target);
63 }
64 catch (ex) {
65 do_throw(namespace);
66 }
67 }
69 function test_failed_mapping(namespace)
70 {
71 var uri = gIOS.newURI("chrome://" + namespace + "/content/test.xul",
72 null, null);
73 try {
74 var result = chromeReg.convertChromeURL(uri);
75 do_throw(namespace);
76 }
77 catch (ex) {
78 }
79 }
81 function run_test()
82 {
83 test_succeeded_mapping("test1");
84 test_succeeded_mapping("test2");
85 test_succeeded_mapping("test3");
86 test_succeeded_mapping("test4");
87 test_succeeded_mapping("test5");
88 test_failed_mapping("test6");
89 test_failed_mapping("test7");
90 test_failed_mapping("test8");
91 test_failed_mapping("test9");
92 test_failed_mapping("test10");
93 test_failed_mapping("test11");
94 }