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 /* 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 /**
7 * This attempts to test all the possible variations of |operator==|
8 * used with |nsCOMPtr|s. Currently only the tests where pointers
9 * are to the same class are enabled. It's not clear whether we
10 * should be supporting other tests, and some of them won't work
11 * on at least some platforms. If we add separate comparisons
12 * for nsCOMPtr<nsISupports> we'll need to add more tests for
13 * those cases.
14 */
16 #include "nsCOMPtr.h"
18 // Don't test these now, since some of them won't work and it's
19 // not clear whether they should (see above).
20 #undef NSCAP_EQTEST_TEST_ACROSS_TYPES
22 #define NS_ICOMPTREQTESTFOO_IID \
23 {0x8eb5bbef, 0xd1a3, 0x4659, \
24 {0x9c, 0xf6, 0xfd, 0xf3, 0xe4, 0xd2, 0x00, 0x0e}}
26 class nsICOMPtrEqTestFoo : public nsISupports {
27 public:
28 NS_DECLARE_STATIC_IID_ACCESSOR(NS_ICOMPTREQTESTFOO_IID)
29 };
31 NS_DEFINE_STATIC_IID_ACCESSOR(nsICOMPtrEqTestFoo, NS_ICOMPTREQTESTFOO_IID)
33 #ifdef NSCAP_EQTEST_TEST_ACROSS_TYPES
35 #define NS_ICOMPTREQTESTFOO2_IID \
36 {0x6516387b, 0x36c5, 0x4036, \
37 {0x82, 0xc9, 0xa7, 0x4d, 0xd9, 0xe5, 0x92, 0x2f}}
39 class nsICOMPtrEqTestFoo2 : public nsISupports {
40 public:
41 NS_DECLARE_STATIC_IID_ACCESSOR(NS_ICOMPTREQTESTFOO2_IID)
42 };
44 NS_DEFINE_STATIC_IID_ACCESSOR(nsICOMPtrEqTestFoo2, NS_ICOMPTREQTESTFOO2_IID)
46 #endif
48 int
49 main()
50 {
51 nsCOMPtr<nsICOMPtrEqTestFoo> s;
52 nsICOMPtrEqTestFoo* r = 0;
53 const nsCOMPtr<nsICOMPtrEqTestFoo> sc;
54 const nsICOMPtrEqTestFoo* rc = 0;
55 nsICOMPtrEqTestFoo* const rk = 0;
56 const nsICOMPtrEqTestFoo* const rkc = 0;
57 nsICOMPtrEqTestFoo* d = s;
59 #ifdef NSCAP_EQTEST_TEST_ACROSS_TYPES
60 nsCOMPtr<nsICOMPtrEqTestFoo2> s2;
61 nsICOMPtrEqTestFoo2* r2 = 0;
62 const nsCOMPtr<nsICOMPtrEqTestFoo2> sc2;
63 const nsICOMPtrEqTestFoo2* rc2 = 0;
64 nsICOMPtrEqTestFoo2* const rk2 = 0;
65 const nsICOMPtrEqTestFoo2* const rkc2 = 0;
66 nsICOMPtrEqTestFoo2* d2 = s2;
67 #endif
69 return (!(true &&
70 (s == s) &&
71 (s == r) &&
72 (s == sc) &&
73 (s == rc) &&
74 (s == rk) &&
75 (s == rkc) &&
76 (s == d) &&
77 (r == s) &&
78 (r == sc) &&
79 (r == rc) &&
80 (r == rk) &&
81 (r == rkc) &&
82 (r == d) &&
83 (sc == s) &&
84 (sc == r) &&
85 (sc == sc) &&
86 (sc == rc) &&
87 (sc == rk) &&
88 (sc == rkc) &&
89 (sc == d) &&
90 (rc == s) &&
91 (rc == r) &&
92 (rc == sc) &&
93 (rc == rk) &&
94 (rc == rkc) &&
95 (rc == d) &&
96 (rk == s) &&
97 (rk == r) &&
98 (rk == sc) &&
99 (rk == rc) &&
100 (rk == rkc) &&
101 (rk == d) &&
102 (rkc == s) &&
103 (rkc == r) &&
104 (rkc == sc) &&
105 (rkc == rc) &&
106 (rkc == rk) &&
107 (rkc == d) &&
108 (d == s) &&
109 (d == r) &&
110 (d == sc) &&
111 (d == rc) &&
112 (d == rk) &&
113 (d == rkc) &&
114 #ifdef NSCAP_EQTEST_TEST_ACROSS_TYPES
115 (s == s2) &&
116 (s == r2) &&
117 (s == sc2) &&
118 (s == rc2) &&
119 (s == rk2) &&
120 (s == rkc2) &&
121 (s == d2) &&
122 (r == s2) &&
123 (r == r2) &&
124 (r == sc2) &&
125 (r == rc2) &&
126 (r == rk2) &&
127 (r == rkc2) &&
128 (r == d2) &&
129 (sc == s2) &&
130 (sc == r2) &&
131 (sc == sc2) &&
132 (sc == rc2) &&
133 (sc == rk2) &&
134 (sc == rkc2) &&
135 (sc == d2) &&
136 (rc == s2) &&
137 (rc == r2) &&
138 (rc == sc2) &&
139 (rc == rc2) &&
140 (rc == rk2) &&
141 (rc == rkc2) &&
142 (rc == d2) &&
143 (rk == s2) &&
144 (rk == r2) &&
145 (rk == sc2) &&
146 (rk == rc2) &&
147 (rk == rk2) &&
148 (rk == rkc2) &&
149 (rk == d2) &&
150 (rkc == s2) &&
151 (rkc == r2) &&
152 (rkc == sc2) &&
153 (rkc == rc2) &&
154 (rkc == rk2) &&
155 (rkc == rkc2) &&
156 (rkc == d2) &&
157 (d == s2) &&
158 (d == r2) &&
159 (d == sc2) &&
160 (d == rc2) &&
161 (d == rk2) &&
162 (d == rkc2) &&
163 (d == d2) &&
164 #endif
165 true));
166 }