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;
48 NS_ASSERTION(dispatchParams,"no place for params");
49 if (!dispatchParams)
50 return NS_ERROR_OUT_OF_MEMORY;
52 uint32_t* ap = args;
53 for(i = 0; i < paramCount; i++, ap++)
54 {
55 const nsXPTParamInfo& param = info->GetParam(i);
56 const nsXPTType& type = param.GetType();
57 nsXPTCMiniVariant* dp = &dispatchParams[i];
59 if(param.IsOut() || !type.IsArithmetic())
60 {
61 dp->val.p = (void*) *ap;
62 continue;
63 }
64 // else
65 switch(type)
66 {
67 case nsXPTType::T_I8 : dp->val.i8 = *((int32_t*) ap); break;
68 case nsXPTType::T_I16 : dp->val.i16 = *((int32_t*) ap); break;
69 case nsXPTType::T_I32 : dp->val.i32 = *((int32_t*) ap); break;
70 case nsXPTType::T_DOUBLE :
71 case nsXPTType::T_U64 :
72 case nsXPTType::T_I64 : ((DU *)dp)->hi = ((DU *)ap)->hi;
73 ((DU *)dp)->lo = ((DU *)ap)->lo;
74 ap++;
75 break;
76 case nsXPTType::T_U8 : dp->val.u8 = *((uint32_t*)ap); break;
77 case nsXPTType::T_U16 : dp->val.u16 = *((uint32_t*)ap); break;
78 case nsXPTType::T_U32 : dp->val.u32 = *((uint32_t*)ap); break;
79 case nsXPTType::T_FLOAT : dp->val.f = *((float*) ap); break;
80 case nsXPTType::T_BOOL : dp->val.b = *((uint32_t*)ap); break;
81 case nsXPTType::T_CHAR : dp->val.c = *((uint32_t*)ap); break;
82 case nsXPTType::T_WCHAR : dp->val.wc = *((int32_t*) ap); break;
83 default:
84 NS_ERROR("bad type");
85 break;
86 }
87 }
89 result = self->CallMethod((uint16_t)methodIndex, info, dispatchParams);
91 NS_RELEASE(iface_info);
93 if(dispatchParams != paramBuffer)
94 delete [] dispatchParams;
96 return result;
97 }
99 extern "C" nsresult SharedStub(int, int*);
101 #define STUB_ENTRY(n) \
102 nsresult nsXPTCStubBase::Stub##n() \
103 { \
104 int dummy; /* defeat tail-call optimization */ \
105 return SharedStub(n, &dummy); \
106 }
108 #define SENTINEL_ENTRY(n) \
109 nsresult nsXPTCStubBase::Sentinel##n() \
110 { \
111 NS_ERROR("nsXPTCStubBase::Sentinel called"); \
112 return NS_ERROR_NOT_IMPLEMENTED; \
113 }
115 #include "xptcstubsdef.inc"
117 #endif /* sparc || __sparc__ */