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 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 /* entry point wrappers. */
8 #include "xptcprivate.h"
9 #include "xptiprivate.h"
10 #include "mozilla/XPTInterfaceInfoManager.h"
12 using namespace mozilla;
14 NS_IMETHODIMP
15 nsXPTCStubBase::QueryInterface(REFNSIID aIID,
16 void **aInstancePtr)
17 {
18 if (aIID.Equals(mEntry->IID())) {
19 NS_ADDREF_THIS();
20 *aInstancePtr = static_cast<nsISupports*>(this);
21 return NS_OK;
22 }
24 return mOuter->QueryInterface(aIID, aInstancePtr);
25 }
27 NS_IMETHODIMP_(MozExternalRefCountType)
28 nsXPTCStubBase::AddRef()
29 {
30 return mOuter->AddRef();
31 }
33 NS_IMETHODIMP_(MozExternalRefCountType)
34 nsXPTCStubBase::Release()
35 {
36 return mOuter->Release();
37 }
39 EXPORT_XPCOM_API(nsresult)
40 NS_GetXPTCallStub(REFNSIID aIID, nsIXPTCProxy* aOuter,
41 nsISomeInterface* *aResult)
42 {
43 if (NS_WARN_IF(!aOuter) || NS_WARN_IF(!aResult))
44 return NS_ERROR_INVALID_ARG;
46 XPTInterfaceInfoManager *iim =
47 XPTInterfaceInfoManager::GetSingleton();
48 if (NS_WARN_IF(!iim))
49 return NS_ERROR_NOT_INITIALIZED;
51 xptiInterfaceEntry *iie = iim->GetInterfaceEntryForIID(&aIID);
52 if (!iie || !iie->EnsureResolved() || iie->GetBuiltinClassFlag())
53 return NS_ERROR_FAILURE;
55 nsXPTCStubBase* newbase = new nsXPTCStubBase(aOuter, iie);
56 if (!newbase)
57 return NS_ERROR_OUT_OF_MEMORY;
59 *aResult = newbase;
60 return NS_OK;
61 }
63 EXPORT_XPCOM_API(void)
64 NS_DestroyXPTCallStub(nsISomeInterface* aStub)
65 {
66 nsXPTCStubBase* stub = static_cast<nsXPTCStubBase*>(aStub);
67 delete(stub);
68 }