toolkit/forgetaboutsite/test/unit/head_forgetaboutsite.js

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

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 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 2 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 4
michael@0 5 const Cc = Components.classes;
michael@0 6 const Ci = Components.interfaces;
michael@0 7 const Cu = Components.utils;
michael@0 8
michael@0 9 var dirSvc = Cc["@mozilla.org/file/directory_service;1"].getService(Ci.nsIProperties);
michael@0 10 var profileDir = do_get_profile();
michael@0 11
michael@0 12 /**
michael@0 13 * Removes any files that could make our tests fail.
michael@0 14 */
michael@0 15 function cleanUp()
michael@0 16 {
michael@0 17 let files = [
michael@0 18 "downloads.sqlite",
michael@0 19 "places.sqlite",
michael@0 20 "cookies.sqlite",
michael@0 21 "signons.sqlite",
michael@0 22 "permissions.sqlite"
michael@0 23 ];
michael@0 24
michael@0 25 for (let i = 0; i < files.length; i++) {
michael@0 26 let file = dirSvc.get("ProfD", Ci.nsIFile);
michael@0 27 file.append(files[i]);
michael@0 28 if (file.exists())
michael@0 29 file.remove(false);
michael@0 30 }
michael@0 31 }
michael@0 32 cleanUp();
michael@0 33
michael@0 34 function oldDownloadManagerDisabled()
michael@0 35 {
michael@0 36 try {
michael@0 37 // This method throws an exception if the old Download Manager is disabled.
michael@0 38 Services.downloads.activeDownloadCount;
michael@0 39 } catch (ex) {
michael@0 40 return true;
michael@0 41 }
michael@0 42 return false;
michael@0 43 }

mercurial