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 /* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim:set ts=2 sw=2 sts=2 et: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 const Cr = Components.results;
8 const Ci = Components.interfaces;
10 const CC = Components.Constructor;
11 var LocalFile = CC("@mozilla.org/file/local;1", "nsILocalFile", "initWithPath");
13 function run_test()
14 {
15 test_normalized_vs_non_normalized();
16 }
18 function test_normalized_vs_non_normalized()
19 {
20 // get a directory that exists on all platforms
21 var dirProvider = Components.classes["@mozilla.org/file/directory_service;1"].getService(Ci.nsIProperties);
22 var tmp1 = dirProvider.get("TmpD", Ci.nsILocalFile);
23 var exists = tmp1.exists();
24 do_check_true(exists);
25 if (!exists)
26 return;
28 // this has the same exact path as tmp1, it should equal tmp1
29 var tmp2 = new LocalFile(tmp1.path);
30 do_check_true(tmp1.equals(tmp2));
32 // this is a non-normalized version of tmp1, it should not equal tmp1
33 tmp2.appendRelativePath(".");
34 do_check_false(tmp1.equals(tmp2));
36 // normalize and make sure they are equivalent again
37 tmp2.normalize();
38 do_check_true(tmp1.equals(tmp2));
39 }