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