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 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 2 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 3 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 4 | |
michael@0 | 5 | #ifdef DEF |
michael@0 | 6 | DEF(This) |
michael@0 | 7 | DEF(is) |
michael@0 | 8 | DEF(a) |
michael@0 | 9 | DEF(test) |
michael@0 | 10 | DEF(of) |
michael@0 | 11 | DEF(string) |
michael@0 | 12 | DEF(array) |
michael@0 | 13 | DEF(for) |
michael@0 | 14 | DEF(use) |
michael@0 | 15 | DEF(with) |
michael@0 | 16 | DEF(elfhack) |
michael@0 | 17 | DEF(to) |
michael@0 | 18 | DEF(see) |
michael@0 | 19 | DEF(whether) |
michael@0 | 20 | DEF(it) |
michael@0 | 21 | DEF(breaks) |
michael@0 | 22 | DEF(anything) |
michael@0 | 23 | DEF(but) |
michael@0 | 24 | DEF(one) |
michael@0 | 25 | DEF(needs) |
michael@0 | 26 | DEF(quite) |
michael@0 | 27 | DEF(some) |
michael@0 | 28 | DEF(strings) |
michael@0 | 29 | DEF(before) |
michael@0 | 30 | DEF(the) |
michael@0 | 31 | DEF(program) |
michael@0 | 32 | DEF(can) |
michael@0 | 33 | DEF(do) |
michael@0 | 34 | DEF(its) |
michael@0 | 35 | DEF(work) |
michael@0 | 36 | DEF(efficiently) |
michael@0 | 37 | DEF(Without) |
michael@0 | 38 | DEF(enough) |
michael@0 | 39 | DEF(data) |
michael@0 | 40 | DEF(relocation) |
michael@0 | 41 | DEF(sections) |
michael@0 | 42 | DEF(are) |
michael@0 | 43 | DEF(not) |
michael@0 | 44 | DEF(sufficiently) |
michael@0 | 45 | DEF(large) |
michael@0 | 46 | DEF(and) |
michael@0 | 47 | DEF(injected) |
michael@0 | 48 | DEF(code) |
michael@0 | 49 | DEF(wouldnt) |
michael@0 | 50 | DEF(fit) |
michael@0 | 51 | DEF(Said) |
michael@0 | 52 | DEF(otherwise) |
michael@0 | 53 | DEF(we) |
michael@0 | 54 | DEF(need) |
michael@0 | 55 | DEF(more) |
michael@0 | 56 | DEF(words) |
michael@0 | 57 | DEF(than) |
michael@0 | 58 | DEF(up) |
michael@0 | 59 | DEF(here) |
michael@0 | 60 | DEF(so) |
michael@0 | 61 | DEF(that) |
michael@0 | 62 | DEF(relocations) |
michael@0 | 63 | DEF(take) |
michael@0 | 64 | DEF(significant) |
michael@0 | 65 | DEF(bytes) |
michael@0 | 66 | DEF(amounts) |
michael@0 | 67 | DEF(which) |
michael@0 | 68 | DEF(isnt) |
michael@0 | 69 | DEF(exactly) |
michael@0 | 70 | DEF(easily) |
michael@0 | 71 | DEF(achieved) |
michael@0 | 72 | DEF(like) |
michael@0 | 73 | DEF(this) |
michael@0 | 74 | DEF(Actually) |
michael@0 | 75 | DEF(I) |
michael@0 | 76 | DEF(must) |
michael@0 | 77 | DEF(cheat) |
michael@0 | 78 | DEF(by) |
michael@0 | 79 | DEF(including) |
michael@0 | 80 | DEF(these) |
michael@0 | 81 | DEF(phrases) |
michael@0 | 82 | DEF(several) |
michael@0 | 83 | DEF(times) |
michael@0 | 84 | |
michael@0 | 85 | #else |
michael@0 | 86 | #pragma GCC visibility push(default) |
michael@0 | 87 | #include <stdlib.h> |
michael@0 | 88 | #include <stdio.h> |
michael@0 | 89 | |
michael@0 | 90 | #define DEF(w) static const char str_ ## w[] = #w; |
michael@0 | 91 | #include "test.c" |
michael@0 | 92 | #undef DEF |
michael@0 | 93 | |
michael@0 | 94 | const char *strings[] = { |
michael@0 | 95 | #define DEF(w) str_ ## w, |
michael@0 | 96 | #include "test.c" |
michael@0 | 97 | #include "test.c" |
michael@0 | 98 | #include "test.c" |
michael@0 | 99 | }; |
michael@0 | 100 | |
michael@0 | 101 | /* Create a hole between two zones of relative relocations */ |
michael@0 | 102 | const int hole[] = { |
michael@0 | 103 | 42, 42, 42, 42 |
michael@0 | 104 | }; |
michael@0 | 105 | |
michael@0 | 106 | const char *strings2[] = { |
michael@0 | 107 | #include "test.c" |
michael@0 | 108 | #include "test.c" |
michael@0 | 109 | #include "test.c" |
michael@0 | 110 | #include "test.c" |
michael@0 | 111 | #include "test.c" |
michael@0 | 112 | #undef DEF |
michael@0 | 113 | }; |
michael@0 | 114 | |
michael@0 | 115 | static int ret = 1; |
michael@0 | 116 | |
michael@0 | 117 | int print_status() { |
michael@0 | 118 | fprintf(stderr, "%s\n", ret ? "FAIL" : "PASS"); |
michael@0 | 119 | return ret; |
michael@0 | 120 | } |
michael@0 | 121 | |
michael@0 | 122 | /* On ARM, this creates a .tbss section before .init_array, which |
michael@0 | 123 | * elfhack could then pick instead of .init_array. |
michael@0 | 124 | * Also, when .tbss is big enough, elfhack may wrongfully consider |
michael@0 | 125 | * following sections as part of the PT_TLS segment. |
michael@0 | 126 | * Finally, gold makes TLS segments end on an aligned virtual address, |
michael@0 | 127 | * even when the underlying section ends before that, and elfhack |
michael@0 | 128 | * sanity checks may yield an error. */ |
michael@0 | 129 | __thread int foo; |
michael@0 | 130 | __thread long long int bar[512]; |
michael@0 | 131 | |
michael@0 | 132 | void end_test() { |
michael@0 | 133 | static int count = 0; |
michael@0 | 134 | /* Only exit when both constructors have been called */ |
michael@0 | 135 | if (++count == 2) |
michael@0 | 136 | ret = 0; |
michael@0 | 137 | } |
michael@0 | 138 | |
michael@0 | 139 | void test() { |
michael@0 | 140 | int i = 0, j = 0; |
michael@0 | 141 | #define DEF_(a,i,w) \ |
michael@0 | 142 | if (a[i++] != str_ ## w) return; |
michael@0 | 143 | #define DEF(w) DEF_(strings,i,w) |
michael@0 | 144 | #include "test.c" |
michael@0 | 145 | #include "test.c" |
michael@0 | 146 | #include "test.c" |
michael@0 | 147 | #undef DEF |
michael@0 | 148 | #define DEF(w) DEF_(strings2,j,w) |
michael@0 | 149 | #include "test.c" |
michael@0 | 150 | #include "test.c" |
michael@0 | 151 | #include "test.c" |
michael@0 | 152 | #include "test.c" |
michael@0 | 153 | #include "test.c" |
michael@0 | 154 | #undef DEF |
michael@0 | 155 | if (i != sizeof(strings)/sizeof(strings[0]) && |
michael@0 | 156 | j != sizeof(strings2)/sizeof(strings2[0])) |
michael@0 | 157 | fprintf(stderr, "WARNING: Test doesn't cover the whole array\n"); |
michael@0 | 158 | end_test(); |
michael@0 | 159 | } |
michael@0 | 160 | |
michael@0 | 161 | #pragma GCC visibility pop |
michael@0 | 162 | #endif |