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 /* Implement shared vtbl methods. */
8 #include "xptcprivate.h"
10 #if defined(sparc) || defined(__sparc__)
12 extern "C" nsresult ATTRIBUTE_USED
13 PrepareAndDispatch(nsXPTCStubBase* self, uint32_t methodIndex, uint32_t* args)
14 {
16 typedef struct {
17 uint32_t hi;
18 uint32_t lo;
19 } DU; // have to move 64 bit entities as 32 bit halves since
20 // stack slots are not guaranteed 16 byte aligned
22 #define PARAM_BUFFER_COUNT 16
24 nsXPTCMiniVariant paramBuffer[PARAM_BUFFER_COUNT];
25 nsXPTCMiniVariant* dispatchParams = nullptr;
26 nsIInterfaceInfo* iface_info = nullptr;
27 const nsXPTMethodInfo* info;
28 uint8_t paramCount;
29 uint8_t i;
30 nsresult result = NS_ERROR_FAILURE;
32 NS_ASSERTION(self,"no self");
34 self->GetInterfaceInfo(&iface_info);
35 NS_ASSERTION(iface_info,"no interface info");
37 iface_info->GetMethodInfo(uint16_t(methodIndex), &info);
38 NS_ASSERTION(info,"no interface info");
40 paramCount = info->GetParamCount();
42 // setup variant array pointer
43 if(paramCount > PARAM_BUFFER_COUNT)
44 dispatchParams = new nsXPTCMiniVariant[paramCount];
45 else
46 dispatchParams = paramBuffer;
47 NS_ASSERTION(dispatchParams,"no place for params");
49 uint32_t* ap = args;
50 for(i = 0; i < paramCount; i++, ap++)
51 {
52 const nsXPTParamInfo& param = info->GetParam(i);
53 const nsXPTType& type = param.GetType();
54 nsXPTCMiniVariant* dp = &dispatchParams[i];
56 if(param.IsOut() || !type.IsArithmetic())
57 {
58 dp->val.p = (void*) *ap;
59 continue;
60 }
61 // else
62 switch(type)
63 {
64 case nsXPTType::T_I8 : dp->val.i8 = *((int32_t*) ap); break;
65 case nsXPTType::T_I16 : dp->val.i16 = *((int32_t*) ap); break;
66 case nsXPTType::T_I32 : dp->val.i32 = *((int32_t*) ap); break;
67 case nsXPTType::T_DOUBLE :
68 case nsXPTType::T_U64 :
69 case nsXPTType::T_I64 : ((DU *)dp)->hi = ((DU *)ap)->hi;
70 ((DU *)dp)->lo = ((DU *)ap)->lo;
71 ap++;
72 break;
73 case nsXPTType::T_U8 : dp->val.u8 = *((uint32_t*)ap); break;
74 case nsXPTType::T_U16 : dp->val.u16 = *((uint32_t*)ap); break;
75 case nsXPTType::T_U32 : dp->val.u32 = *((uint32_t*)ap); break;
76 case nsXPTType::T_FLOAT : dp->val.f = *((float*) ap); break;
77 case nsXPTType::T_BOOL : dp->val.b = *((uint32_t*)ap); break;
78 case nsXPTType::T_CHAR : dp->val.c = *((uint32_t*)ap); break;
79 case nsXPTType::T_WCHAR : dp->val.wc = *((int32_t*) ap); break;
80 default:
81 NS_ERROR("bad type");
82 break;
83 }
84 }
86 result = self->CallMethod((uint16_t)methodIndex, info, dispatchParams);
88 NS_RELEASE(iface_info);
90 if(dispatchParams != paramBuffer)
91 delete [] dispatchParams;
93 return result;
94 }
96 extern "C" nsresult SharedStub(int, int*);
98 #define STUB_ENTRY(n) \
99 nsresult nsXPTCStubBase::Stub##n() \
100 { \
101 int dummy; /* defeat tail-call optimization */ \
102 return SharedStub(n, &dummy); \
103 }
105 #define SENTINEL_ENTRY(n) \
106 nsresult nsXPTCStubBase::Sentinel##n() \
107 { \
108 NS_ERROR("nsXPTCStubBase::Sentinel called"); \
109 return NS_ERROR_NOT_IMPLEMENTED; \
110 }
112 #include "xptcstubsdef.inc"
114 #endif /* sparc || __sparc__ */