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 | // Copyright (c) 2012, Google Inc. |
michael@0 | 2 | // All rights reserved. |
michael@0 | 3 | // |
michael@0 | 4 | // Redistribution and use in source and binary forms, with or without |
michael@0 | 5 | // modification, are permitted provided that the following conditions are |
michael@0 | 6 | // met: |
michael@0 | 7 | // |
michael@0 | 8 | // * Redistributions of source code must retain the above copyright |
michael@0 | 9 | // notice, this list of conditions and the following disclaimer. |
michael@0 | 10 | // * Redistributions in binary form must reproduce the above |
michael@0 | 11 | // copyright notice, this list of conditions and the following disclaimer |
michael@0 | 12 | // in the documentation and/or other materials provided with the |
michael@0 | 13 | // distribution. |
michael@0 | 14 | // * Neither the name of Google Inc. nor the names of its |
michael@0 | 15 | // contributors may be used to endorse or promote products derived from |
michael@0 | 16 | // this software without specific prior written permission. |
michael@0 | 17 | // |
michael@0 | 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
michael@0 | 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
michael@0 | 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
michael@0 | 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
michael@0 | 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
michael@0 | 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
michael@0 | 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
michael@0 | 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
michael@0 | 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
michael@0 | 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
michael@0 | 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
michael@0 | 29 | |
michael@0 | 30 | #ifndef GOOGLE_BREAKPAD_COMMON_ANDROID_INCLUDE_ELF_H |
michael@0 | 31 | #define GOOGLE_BREAKPAD_COMMON_ANDROID_INCLUDE_ELF_H |
michael@0 | 32 | |
michael@0 | 33 | #include <stdint.h> |
michael@0 | 34 | #include <libgen.h> |
michael@0 | 35 | |
michael@0 | 36 | #ifdef __cplusplus |
michael@0 | 37 | extern "C" { |
michael@0 | 38 | #endif // __cplusplus |
michael@0 | 39 | |
michael@0 | 40 | // The Android <elf.h> provides BSD-based definitions for the ElfXX_Nhdr |
michael@0 | 41 | // types |
michael@0 | 42 | // always source-compatible with the GLibc/kernel ones. To overcome this |
michael@0 | 43 | // issue without modifying a lot of code in Breakpad, use an ugly macro |
michael@0 | 44 | // renaming trick with #include_next |
michael@0 | 45 | |
michael@0 | 46 | // Avoid conflict with BSD-based definition of ElfXX_Nhdr. |
michael@0 | 47 | // Unfortunately, their field member names do not use a 'n_' prefix. |
michael@0 | 48 | #define Elf32_Nhdr __bsd_Elf32_Nhdr |
michael@0 | 49 | #define Elf64_Nhdr __bsd_Elf64_Nhdr |
michael@0 | 50 | |
michael@0 | 51 | // In case they are defined by the NDK version |
michael@0 | 52 | #define Elf32_auxv_t __bionic_Elf32_auxv_t |
michael@0 | 53 | #define Elf64_auxv_t __bionic_Elf64_auxv_t |
michael@0 | 54 | |
michael@0 | 55 | #define Elf32_Dyn __bionic_Elf32_Dyn |
michael@0 | 56 | #define Elf64_Dyn __bionic_Elf64_Dyn |
michael@0 | 57 | |
michael@0 | 58 | #include_next <elf.h> |
michael@0 | 59 | |
michael@0 | 60 | #undef Elf32_Nhdr |
michael@0 | 61 | #undef Elf64_Nhdr |
michael@0 | 62 | |
michael@0 | 63 | typedef struct { |
michael@0 | 64 | Elf32_Word n_namesz; |
michael@0 | 65 | Elf32_Word n_descsz; |
michael@0 | 66 | Elf32_Word n_type; |
michael@0 | 67 | } Elf32_Nhdr; |
michael@0 | 68 | |
michael@0 | 69 | typedef struct { |
michael@0 | 70 | Elf64_Word n_namesz; |
michael@0 | 71 | Elf64_Word n_descsz; |
michael@0 | 72 | Elf64_Word n_type; |
michael@0 | 73 | } Elf64_Nhdr; |
michael@0 | 74 | |
michael@0 | 75 | #undef Elf32_auxv_t |
michael@0 | 76 | #undef Elf64_auxv_t |
michael@0 | 77 | |
michael@0 | 78 | typedef struct { |
michael@0 | 79 | uint32_t a_type; |
michael@0 | 80 | union { |
michael@0 | 81 | uint32_t a_val; |
michael@0 | 82 | } a_un; |
michael@0 | 83 | } Elf32_auxv_t; |
michael@0 | 84 | |
michael@0 | 85 | typedef struct { |
michael@0 | 86 | uint64_t a_type; |
michael@0 | 87 | union { |
michael@0 | 88 | uint64_t a_val; |
michael@0 | 89 | } a_un; |
michael@0 | 90 | } Elf64_auxv_t; |
michael@0 | 91 | |
michael@0 | 92 | #undef Elf32_Dyn |
michael@0 | 93 | #undef Elf64_Dyn |
michael@0 | 94 | |
michael@0 | 95 | typedef struct { |
michael@0 | 96 | Elf32_Sword d_tag; |
michael@0 | 97 | union { |
michael@0 | 98 | Elf32_Word d_val; |
michael@0 | 99 | Elf32_Addr d_ptr; |
michael@0 | 100 | } d_un; |
michael@0 | 101 | } Elf32_Dyn; |
michael@0 | 102 | |
michael@0 | 103 | typedef struct { |
michael@0 | 104 | Elf64_Sxword d_tag; |
michael@0 | 105 | union { |
michael@0 | 106 | Elf64_Xword d_val; |
michael@0 | 107 | Elf64_Addr d_ptr; |
michael@0 | 108 | } d_un; |
michael@0 | 109 | } Elf64_Dyn; |
michael@0 | 110 | |
michael@0 | 111 | |
michael@0 | 112 | // __WORDSIZE is GLibc-specific and used by Google Breakpad on Linux. |
michael@0 | 113 | // All Android platforms are 32-bit for now. |
michael@0 | 114 | #ifndef __WORDSIZE |
michael@0 | 115 | #define __WORDSIZE 32 |
michael@0 | 116 | #endif |
michael@0 | 117 | |
michael@0 | 118 | // The Android headers don't always define this constant. |
michael@0 | 119 | #ifndef EM_X86_64 |
michael@0 | 120 | #define EM_X86_64 62 |
michael@0 | 121 | #endif |
michael@0 | 122 | |
michael@0 | 123 | #ifndef EM_PPC64 |
michael@0 | 124 | #define EM_PPC64 21 |
michael@0 | 125 | #endif |
michael@0 | 126 | |
michael@0 | 127 | #ifndef EM_S390 |
michael@0 | 128 | #define EM_S390 22 |
michael@0 | 129 | #endif |
michael@0 | 130 | |
michael@0 | 131 | #if !defined(AT_SYSINFO_EHDR) |
michael@0 | 132 | #define AT_SYSINFO_EHDR 33 |
michael@0 | 133 | #endif |
michael@0 | 134 | |
michael@0 | 135 | #if !defined(NT_PRSTATUS) |
michael@0 | 136 | #define NT_PRSTATUS 1 |
michael@0 | 137 | #endif |
michael@0 | 138 | |
michael@0 | 139 | #if !defined(NT_PRPSINFO) |
michael@0 | 140 | #define NT_PRPSINFO 3 |
michael@0 | 141 | #endif |
michael@0 | 142 | |
michael@0 | 143 | #if !defined(NT_AUXV) |
michael@0 | 144 | #define NT_AUXV 6 |
michael@0 | 145 | #endif |
michael@0 | 146 | |
michael@0 | 147 | #if !defined(NT_PRXFPREG) |
michael@0 | 148 | #define NT_PRXFPREG 0x46e62b7f |
michael@0 | 149 | #endif |
michael@0 | 150 | |
michael@0 | 151 | #if !defined(NT_FPREGSET) |
michael@0 | 152 | #define NT_FPREGSET 2 |
michael@0 | 153 | #endif |
michael@0 | 154 | |
michael@0 | 155 | #ifdef __cplusplus |
michael@0 | 156 | } // extern "C" |
michael@0 | 157 | #endif // __cplusplus |
michael@0 | 158 | |
michael@0 | 159 | #endif // GOOGLE_BREAKPAD_COMMON_ANDROID_INCLUDE_ELF_H |