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: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
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 "nsNetUtil.h" |
michael@0 | 7 | #include "nsIURI.h" |
michael@0 | 8 | |
michael@0 | 9 | #include "nsISystemProxySettings.h" |
michael@0 | 10 | #include "nsIServiceManager.h" |
michael@0 | 11 | #include "mozilla/ModuleUtils.h" |
michael@0 | 12 | #include "nsPrintfCString.h" |
michael@0 | 13 | #include "nsNetUtil.h" |
michael@0 | 14 | #include "nsISupportsPrimitives.h" |
michael@0 | 15 | #include "nsIURI.h" |
michael@0 | 16 | |
michael@0 | 17 | #include "AndroidBridge.h" |
michael@0 | 18 | |
michael@0 | 19 | class nsAndroidSystemProxySettings : public nsISystemProxySettings |
michael@0 | 20 | { |
michael@0 | 21 | public: |
michael@0 | 22 | NS_DECL_THREADSAFE_ISUPPORTS |
michael@0 | 23 | NS_DECL_NSISYSTEMPROXYSETTINGS |
michael@0 | 24 | |
michael@0 | 25 | nsAndroidSystemProxySettings() {}; |
michael@0 | 26 | nsresult Init(); |
michael@0 | 27 | |
michael@0 | 28 | private: |
michael@0 | 29 | ~nsAndroidSystemProxySettings() {}; |
michael@0 | 30 | }; |
michael@0 | 31 | |
michael@0 | 32 | NS_IMPL_ISUPPORTS(nsAndroidSystemProxySettings, nsISystemProxySettings) |
michael@0 | 33 | |
michael@0 | 34 | NS_IMETHODIMP |
michael@0 | 35 | nsAndroidSystemProxySettings::GetMainThreadOnly(bool *aMainThreadOnly) |
michael@0 | 36 | { |
michael@0 | 37 | *aMainThreadOnly = true; |
michael@0 | 38 | return NS_OK; |
michael@0 | 39 | } |
michael@0 | 40 | |
michael@0 | 41 | |
michael@0 | 42 | nsresult |
michael@0 | 43 | nsAndroidSystemProxySettings::Init() |
michael@0 | 44 | { |
michael@0 | 45 | return NS_OK; |
michael@0 | 46 | } |
michael@0 | 47 | |
michael@0 | 48 | nsresult |
michael@0 | 49 | nsAndroidSystemProxySettings::GetPACURI(nsACString& aResult) |
michael@0 | 50 | { |
michael@0 | 51 | return NS_OK; |
michael@0 | 52 | } |
michael@0 | 53 | |
michael@0 | 54 | nsresult |
michael@0 | 55 | nsAndroidSystemProxySettings::GetProxyForURI(const nsACString & aSpec, |
michael@0 | 56 | const nsACString & aScheme, |
michael@0 | 57 | const nsACString & aHost, |
michael@0 | 58 | const int32_t aPort, |
michael@0 | 59 | nsACString & aResult) |
michael@0 | 60 | { |
michael@0 | 61 | return mozilla::AndroidBridge::Bridge()->GetProxyForURI(aSpec, aScheme, aHost, aPort, aResult); |
michael@0 | 62 | } |
michael@0 | 63 | |
michael@0 | 64 | NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsAndroidSystemProxySettings, Init) |
michael@0 | 65 | |
michael@0 | 66 | #define NS_ANDROIDSYSTEMPROXYSERVICE_CID \ |
michael@0 | 67 | {0xf01f0060, 0x3708, 0x478e, \ |
michael@0 | 68 | {0xb9, 0x35, 0x3e, 0xce, 0x8b, 0xe2, 0x94, 0xb8}} |
michael@0 | 69 | |
michael@0 | 70 | NS_DEFINE_NAMED_CID(NS_ANDROIDSYSTEMPROXYSERVICE_CID); |
michael@0 | 71 | |
michael@0 | 72 | void test() {}; |
michael@0 | 73 | |
michael@0 | 74 | static const mozilla::Module::CIDEntry kSysProxyCIDs[] = { |
michael@0 | 75 | { &kNS_ANDROIDSYSTEMPROXYSERVICE_CID, false, nullptr, nsAndroidSystemProxySettingsConstructor }, |
michael@0 | 76 | { nullptr } |
michael@0 | 77 | }; |
michael@0 | 78 | |
michael@0 | 79 | static const mozilla::Module::ContractIDEntry kSysProxyContracts[] = { |
michael@0 | 80 | { NS_SYSTEMPROXYSETTINGS_CONTRACTID, &kNS_ANDROIDSYSTEMPROXYSERVICE_CID }, |
michael@0 | 81 | { nullptr } |
michael@0 | 82 | }; |
michael@0 | 83 | |
michael@0 | 84 | static const mozilla::Module kSysProxyModule = { |
michael@0 | 85 | mozilla::Module::kVersion, |
michael@0 | 86 | kSysProxyCIDs, |
michael@0 | 87 | kSysProxyContracts |
michael@0 | 88 | }; |
michael@0 | 89 | |
michael@0 | 90 | NSMODULE_DEFN(nsAndroidProxyModule) = &kSysProxyModule; |