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) 2006, 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 | // macho_utilties.cc: Utilities for dealing with mach-o files |
michael@0 | 31 | // |
michael@0 | 32 | // Author: Dave Camp |
michael@0 | 33 | |
michael@0 | 34 | #include "common/mac/byteswap.h" |
michael@0 | 35 | #include "common/mac/macho_utilities.h" |
michael@0 | 36 | |
michael@0 | 37 | void breakpad_swap_uuid_command(struct breakpad_uuid_command *uc, |
michael@0 | 38 | enum NXByteOrder target_byte_order) |
michael@0 | 39 | { |
michael@0 | 40 | uc->cmd = ByteSwap(uc->cmd); |
michael@0 | 41 | uc->cmdsize = ByteSwap(uc->cmdsize); |
michael@0 | 42 | } |
michael@0 | 43 | |
michael@0 | 44 | void breakpad_swap_segment_command_64(struct segment_command_64 *sg, |
michael@0 | 45 | enum NXByteOrder target_byte_order) |
michael@0 | 46 | { |
michael@0 | 47 | sg->cmd = ByteSwap(sg->cmd); |
michael@0 | 48 | sg->cmdsize = ByteSwap(sg->cmdsize); |
michael@0 | 49 | |
michael@0 | 50 | sg->vmaddr = ByteSwap(sg->vmaddr); |
michael@0 | 51 | sg->vmsize = ByteSwap(sg->vmsize); |
michael@0 | 52 | sg->fileoff = ByteSwap(sg->fileoff); |
michael@0 | 53 | sg->filesize = ByteSwap(sg->filesize); |
michael@0 | 54 | |
michael@0 | 55 | sg->maxprot = ByteSwap(sg->maxprot); |
michael@0 | 56 | sg->initprot = ByteSwap(sg->initprot); |
michael@0 | 57 | sg->nsects = ByteSwap(sg->nsects); |
michael@0 | 58 | sg->flags = ByteSwap(sg->flags); |
michael@0 | 59 | } |
michael@0 | 60 | |
michael@0 | 61 | void breakpad_swap_mach_header_64(struct mach_header_64 *mh, |
michael@0 | 62 | enum NXByteOrder target_byte_order) |
michael@0 | 63 | { |
michael@0 | 64 | mh->magic = ByteSwap(mh->magic); |
michael@0 | 65 | mh->cputype = ByteSwap(mh->cputype); |
michael@0 | 66 | mh->cpusubtype = ByteSwap(mh->cpusubtype); |
michael@0 | 67 | mh->filetype = ByteSwap(mh->filetype); |
michael@0 | 68 | mh->ncmds = ByteSwap(mh->ncmds); |
michael@0 | 69 | mh->sizeofcmds = ByteSwap(mh->sizeofcmds); |
michael@0 | 70 | mh->flags = ByteSwap(mh->flags); |
michael@0 | 71 | mh->reserved = ByteSwap(mh->reserved); |
michael@0 | 72 | } |
michael@0 | 73 | |
michael@0 | 74 | void breakpad_swap_section_64(struct section_64 *s, |
michael@0 | 75 | uint32_t nsects, |
michael@0 | 76 | enum NXByteOrder target_byte_order) |
michael@0 | 77 | { |
michael@0 | 78 | for (uint32_t i = 0; i < nsects; i++) { |
michael@0 | 79 | s[i].addr = ByteSwap(s[i].addr); |
michael@0 | 80 | s[i].size = ByteSwap(s[i].size); |
michael@0 | 81 | |
michael@0 | 82 | s[i].offset = ByteSwap(s[i].offset); |
michael@0 | 83 | s[i].align = ByteSwap(s[i].align); |
michael@0 | 84 | s[i].reloff = ByteSwap(s[i].reloff); |
michael@0 | 85 | s[i].nreloc = ByteSwap(s[i].nreloc); |
michael@0 | 86 | s[i].flags = ByteSwap(s[i].flags); |
michael@0 | 87 | s[i].reserved1 = ByteSwap(s[i].reserved1); |
michael@0 | 88 | s[i].reserved2 = ByteSwap(s[i].reserved2); |
michael@0 | 89 | } |
michael@0 | 90 | } |