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 /* Platform specific code to invoke XPCOM methods on native objects */
8 #include "xptcprivate.h"
10 #if (_MIPS_SIM != _ABIN32)
11 #error "This code is for MIPS N32 only"
12 #endif
14 extern "C" uint32_t
15 invoke_count_words(uint32_t paramCount, nsXPTCVariant* s)
16 {
17 return paramCount;
18 }
20 extern "C" void
21 invoke_copy_to_stack(uint64_t* d, uint32_t paramCount,
22 nsXPTCVariant* s, uint64_t *regs)
23 {
24 #define N_ARG_REGS 7 /* 8 regs minus 1 for "this" ptr */
26 for (uint32_t i = 0; i < paramCount; i++, s++)
27 {
28 if (s->IsPtrData()) {
29 if (i < N_ARG_REGS)
30 regs[i] = (uint64_t)s->ptr;
31 else
32 *d++ = (uint64_t)s->ptr;
33 continue;
34 }
35 switch (s->type) {
36 //
37 // signed types first
38 //
39 case nsXPTType::T_I8:
40 if (i < N_ARG_REGS)
41 ((int64_t*)regs)[i] = s->val.i8;
42 else
43 *d++ = s->val.i8;
44 break;
45 case nsXPTType::T_I16:
46 if (i < N_ARG_REGS)
47 ((int64_t*)regs)[i] = s->val.i16;
48 else
49 *d++ = s->val.i16;
50 break;
51 case nsXPTType::T_I32:
52 if (i < N_ARG_REGS)
53 ((int64_t*)regs)[i] = s->val.i32;
54 else
55 *d++ = s->val.i32;
56 break;
57 case nsXPTType::T_I64:
58 if (i < N_ARG_REGS)
59 ((int64_t*)regs)[i] = s->val.i64;
60 else
61 *d++ = s->val.i64;
62 break;
63 //
64 // unsigned types next
65 //
66 case nsXPTType::T_U8:
67 if (i < N_ARG_REGS)
68 regs[i] = s->val.u8;
69 else
70 *d++ = s->val.u8;
71 break;
72 case nsXPTType::T_U16:
73 if (i < N_ARG_REGS)
74 regs[i] = s->val.u16;
75 else
76 *d++ = s->val.u16;
77 break;
78 case nsXPTType::T_U32:
79 if (i < N_ARG_REGS)
80 regs[i] = s->val.u32;
81 else
82 *d++ = s->val.u32;
83 break;
84 case nsXPTType::T_U64:
85 if (i < N_ARG_REGS)
86 regs[i] = s->val.u64;
87 else
88 *d++ = s->val.u64;
89 break;
90 case nsXPTType::T_FLOAT:
91 if (i < N_ARG_REGS)
92 *(float*)®s[i] = s->val.f;
93 else
94 *(float*)d++ = s->val.f;
95 break;
96 case nsXPTType::T_DOUBLE:
97 if (i < N_ARG_REGS)
98 *(double*)®s[i] = s->val.d;
99 else
100 *(double*)d++ = s->val.d;
101 break;
102 case nsXPTType::T_BOOL:
103 if (i < N_ARG_REGS)
104 regs[i] = s->val.b;
105 else
106 *d++ = s->val.b;
107 break;
108 case nsXPTType::T_CHAR:
109 if (i < N_ARG_REGS)
110 regs[i] = s->val.c;
111 else
112 *d++ = s->val.c;
113 break;
114 case nsXPTType::T_WCHAR:
115 if (i < N_ARG_REGS)
116 regs[i] = s->val.wc;
117 else
118 *d++ = s->val.wc;
119 break;
120 default:
121 // all the others are plain pointer types
122 if (i < N_ARG_REGS)
123 regs[i] = (uint64_t)s->val.p;
124 else
125 *d++ = (uint64_t)s->val.p;
126 break;
127 }
128 }
129 }
131 extern "C" nsresult _NS_InvokeByIndex(nsISupports* that, uint32_t methodIndex,
132 uint32_t paramCount,
133 nsXPTCVariant* params);
135 EXPORT_XPCOM_API(nsresult)
136 NS_InvokeByIndex(nsISupports* that, uint32_t methodIndex,
137 uint32_t paramCount, nsXPTCVariant* params)
138 {
139 return _NS_InvokeByIndex(that, methodIndex, paramCount, params);
140 }