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 function run_test() {
2 var ios = Components.classes["@mozilla.org/network/io-service;1"].
3 getService(Components.interfaces.nsIIOService);
5 var dataFile = do_get_file("data/bug121341.properties");
7 var channel = ios.newChannelFromURI(ios.newFileURI(dataFile, null, null));
8 var inp = channel.open();
10 var properties = Components.classes["@mozilla.org/persistent-properties;1"].
11 createInstance(Components.interfaces.nsIPersistentProperties);
12 properties.load(inp);
14 var value;
16 value = properties.getStringProperty("1");
17 do_check_eq(value, "abc");
19 value = properties.getStringProperty("2");
20 do_check_eq(value, "xy");
22 value = properties.getStringProperty("3");
23 do_check_eq(value, "\u1234\t\r\n\u00AB\u0001\n");
25 value = properties.getStringProperty("4");
26 do_check_eq(value, "this is multiline property");
28 value = properties.getStringProperty("5");
29 do_check_eq(value, "this is another multiline property");
31 value = properties.getStringProperty("6");
32 do_check_eq(value, "test\u0036");
34 value = properties.getStringProperty("7");
35 do_check_eq(value, "yet another multiline propery");
37 value = properties.getStringProperty("8");
38 do_check_eq(value, "\ttest5\u0020");
40 value = properties.getStringProperty("9");
41 do_check_eq(value, " test6\t");
43 value = properties.getStringProperty("10a\u1234b");
44 do_check_eq(value, "c\uCDEFd");
46 value = properties.getStringProperty("11");
47 do_check_eq(value, "\uABCD");
49 dataFile = do_get_file("data/bug121341-2.properties");
51 channel = ios.newChannelFromURI(ios.newFileURI(dataFile, null, null));
52 inp = channel.open();
54 var properties2 = Components.classes["@mozilla.org/persistent-properties;1"].
55 createInstance(Components.interfaces.nsIPersistentProperties);
56 try {
57 properties2.load(inp);
58 do_throw("load() didn't fail");
59 }
60 catch (e) {
61 }
62 }