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/. */
5 const Cc = Components.classes;
6 const Ci = Components.interfaces;
7 const Cu = Components.utils;
9 var dirSvc = Cc["@mozilla.org/file/directory_service;1"].getService(Ci.nsIProperties);
10 var profileDir = do_get_profile();
12 /**
13 * Removes any files that could make our tests fail.
14 */
15 function cleanUp()
16 {
17 let files = [
18 "downloads.sqlite",
19 "places.sqlite",
20 "cookies.sqlite",
21 "signons.sqlite",
22 "permissions.sqlite"
23 ];
25 for (let i = 0; i < files.length; i++) {
26 let file = dirSvc.get("ProfD", Ci.nsIFile);
27 file.append(files[i]);
28 if (file.exists())
29 file.remove(false);
30 }
31 }
32 cleanUp();
34 function oldDownloadManagerDisabled()
35 {
36 try {
37 // This method throws an exception if the old Download Manager is disabled.
38 Services.downloads.activeDownloadCount;
39 } catch (ex) {
40 return true;
41 }
42 return false;
43 }