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 const Cc = Components.classes;
2 const Ci = Components.interfaces;
4 function run_test() {
5 // skip this test on Windows
6 var isWindows = ("@mozilla.org/windows-registry-key;1" in Components.classes);
7 if (!isWindows) {
8 var testDir = __LOCATION__.parent;
9 // create a test file, then symlink it, then check that we think it's a symlink
10 var targetFile = testDir.clone();
11 targetFile.append("target.txt");
12 if (!targetFile.exists())
13 targetFile.create(Ci.nsIFile.NORMAL_FILE_TYPE, 0644);
15 var link = testDir.clone();
16 link.append("link");
17 if (link.exists())
18 link.remove(false);
20 var ln = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsILocalFile);
21 ln.initWithPath("/bin/ln");
22 var process = Cc["@mozilla.org/process/util;1"].createInstance(Ci.nsIProcess);
23 process.init(ln);
24 var args = ["-s", targetFile.path, link.path];
25 process.run(true, args, args.length);
26 do_check_true(link.isSymlink());
27 }
28 }