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: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2 *
3 * This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 /* Implement shared vtbl methods. */
9 #include "xptcprivate.h"
10 #include "xptiprivate.h"
12 #if defined(sparc) || defined(__sparc__)
14 extern "C" nsresult ATTRIBUTE_USED
15 PrepareAndDispatch(nsXPTCStubBase* self, uint64_t methodIndex, uint64_t* args)
16 {
18 #define PARAM_BUFFER_COUNT 16
20 nsXPTCMiniVariant paramBuffer[PARAM_BUFFER_COUNT];
21 nsXPTCMiniVariant* dispatchParams = nullptr;
22 const nsXPTMethodInfo* info;
23 uint8_t paramCount;
24 uint8_t i;
25 nsresult result = NS_ERROR_FAILURE;
27 NS_ASSERTION(self,"no self");
29 self->mEntry->GetMethodInfo(uint16_t(methodIndex), &info);
30 NS_ASSERTION(info,"no interface info");
32 paramCount = info->GetParamCount();
34 // setup variant array pointer
35 if(paramCount > PARAM_BUFFER_COUNT)
36 dispatchParams = new nsXPTCMiniVariant[paramCount];
37 else
38 dispatchParams = paramBuffer;
39 NS_ASSERTION(dispatchParams,"no place for params");
41 uint64_t* ap = args;
42 for(i = 0; i < paramCount; i++, ap++)
43 {
44 const nsXPTParamInfo& param = info->GetParam(i);
45 const nsXPTType& type = param.GetType();
46 nsXPTCMiniVariant* dp = &dispatchParams[i];
48 if(param.IsOut() || !type.IsArithmetic())
49 {
50 dp->val.p = (void*) *ap;
51 continue;
52 }
53 // else
54 switch(type)
55 {
56 case nsXPTType::T_I8 : dp->val.i8 = *((int64_t*) ap); break;
57 case nsXPTType::T_I16 : dp->val.i16 = *((int64_t*) ap); break;
58 case nsXPTType::T_I32 : dp->val.i32 = *((int64_t*) ap); break;
59 case nsXPTType::T_DOUBLE : dp->val.d = *((double*) ap); break;
60 case nsXPTType::T_U64 : dp->val.u64 = *((uint64_t*)ap); break;
61 case nsXPTType::T_I64 : dp->val.i64 = *((int64_t*) ap); break;
62 case nsXPTType::T_U8 : dp->val.u8 = *((uint64_t*)ap); break;
63 case nsXPTType::T_U16 : dp->val.u16 = *((uint64_t*)ap); break;
64 case nsXPTType::T_U32 : dp->val.u32 = *((uint64_t*)ap); break;
65 case nsXPTType::T_FLOAT : dp->val.f = ((float*) ap)[1]; break;
66 case nsXPTType::T_BOOL : dp->val.b = *((uint64_t*)ap); break;
67 case nsXPTType::T_CHAR : dp->val.c = *((uint64_t*)ap); break;
68 case nsXPTType::T_WCHAR : dp->val.wc = *((int64_t*) ap); break;
69 default:
70 NS_ERROR("bad type");
71 break;
72 }
73 }
75 result = self->mOuter->CallMethod((uint16_t)methodIndex, info, dispatchParams);
77 if(dispatchParams != paramBuffer)
78 delete [] dispatchParams;
80 return result;
81 }
83 extern "C" nsresult SharedStub(int, int*);
85 #define STUB_ENTRY(n) \
86 nsresult nsXPTCStubBase::Stub##n() \
87 { \
88 int dummy; /* defeat tail-call optimization */ \
89 return SharedStub(n, &dummy); \
90 }
92 #define SENTINEL_ENTRY(n) \
93 nsresult nsXPTCStubBase::Sentinel##n() \
94 { \
95 NS_ERROR("nsXPTCStubBase::Sentinel called"); \
96 return NS_ERROR_NOT_IMPLEMENTED; \
97 }
99 #include "xptcstubsdef.inc"
101 #endif /* sparc || __sparc__ */