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