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: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
michael@0 | 2 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 5 | |
michael@0 | 6 | #include "mozilla/ModuleUtils.h" |
michael@0 | 7 | #include "mozilla/Preferences.h" |
michael@0 | 8 | #include "nsPrefBranch.h" |
michael@0 | 9 | #include "prefapi.h" |
michael@0 | 10 | |
michael@0 | 11 | using namespace mozilla; |
michael@0 | 12 | |
michael@0 | 13 | NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(Preferences, |
michael@0 | 14 | Preferences::GetInstanceForService) |
michael@0 | 15 | NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsPrefLocalizedString, Init) |
michael@0 | 16 | NS_GENERIC_FACTORY_CONSTRUCTOR(nsRelativeFilePref) |
michael@0 | 17 | |
michael@0 | 18 | static NS_DEFINE_CID(kPrefServiceCID, NS_PREFSERVICE_CID); |
michael@0 | 19 | static NS_DEFINE_CID(kPrefLocalizedStringCID, NS_PREFLOCALIZEDSTRING_CID); |
michael@0 | 20 | static NS_DEFINE_CID(kRelativeFilePrefCID, NS_RELATIVEFILEPREF_CID); |
michael@0 | 21 | |
michael@0 | 22 | static mozilla::Module::CIDEntry kPrefCIDs[] = { |
michael@0 | 23 | { &kPrefServiceCID, true, nullptr, PreferencesConstructor }, |
michael@0 | 24 | { &kPrefLocalizedStringCID, false, nullptr, nsPrefLocalizedStringConstructor }, |
michael@0 | 25 | { &kRelativeFilePrefCID, false, nullptr, nsRelativeFilePrefConstructor }, |
michael@0 | 26 | { nullptr } |
michael@0 | 27 | }; |
michael@0 | 28 | |
michael@0 | 29 | static mozilla::Module::ContractIDEntry kPrefContracts[] = { |
michael@0 | 30 | { NS_PREFSERVICE_CONTRACTID, &kPrefServiceCID }, |
michael@0 | 31 | { NS_PREFLOCALIZEDSTRING_CONTRACTID, &kPrefLocalizedStringCID }, |
michael@0 | 32 | { NS_RELATIVEFILEPREF_CONTRACTID, &kRelativeFilePrefCID }, |
michael@0 | 33 | // compatibility for extension that uses old service |
michael@0 | 34 | { "@mozilla.org/preferences;1", &kPrefServiceCID }, |
michael@0 | 35 | { nullptr } |
michael@0 | 36 | }; |
michael@0 | 37 | |
michael@0 | 38 | static void |
michael@0 | 39 | UnloadPrefsModule() |
michael@0 | 40 | { |
michael@0 | 41 | Preferences::Shutdown(); |
michael@0 | 42 | } |
michael@0 | 43 | |
michael@0 | 44 | static const mozilla::Module kPrefModule = { |
michael@0 | 45 | mozilla::Module::kVersion, |
michael@0 | 46 | kPrefCIDs, |
michael@0 | 47 | kPrefContracts, |
michael@0 | 48 | nullptr, |
michael@0 | 49 | nullptr, |
michael@0 | 50 | nullptr, |
michael@0 | 51 | UnloadPrefsModule |
michael@0 | 52 | }; |
michael@0 | 53 | |
michael@0 | 54 | NSMODULE_DEFN(nsPrefModule) = &kPrefModule; |