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 | /* |
michael@0 | 2 | * Copyright (c) 1999 |
michael@0 | 3 | * Silicon Graphics Computer Systems, Inc. |
michael@0 | 4 | * |
michael@0 | 5 | * Copyright (c) 1999 |
michael@0 | 6 | * Boris Fomitchev |
michael@0 | 7 | * |
michael@0 | 8 | * This material is provided "as is", with absolutely no warranty expressed |
michael@0 | 9 | * or implied. Any use is at your own risk. |
michael@0 | 10 | * |
michael@0 | 11 | * Permission to use or copy this software for any purpose is hereby granted |
michael@0 | 12 | * without fee, provided the above notices are retained on all copies. |
michael@0 | 13 | * Permission to modify the code and to distribute modified code is granted, |
michael@0 | 14 | * provided the above notices are retained, and a notice that the code was |
michael@0 | 15 | * modified is included with the above copyright notice. |
michael@0 | 16 | * |
michael@0 | 17 | */ |
michael@0 | 18 | |
michael@0 | 19 | #ifndef _STLP_STDIO_FILE_H |
michael@0 | 20 | #define _STLP_STDIO_FILE_H |
michael@0 | 21 | |
michael@0 | 22 | /* This file provides a low-level interface between the internal |
michael@0 | 23 | * representation of struct FILE, from the C stdio library, and |
michael@0 | 24 | * the C++ I/O library. */ |
michael@0 | 25 | |
michael@0 | 26 | #ifndef _STLP_CSTDIO |
michael@0 | 27 | # include <cstdio> |
michael@0 | 28 | #endif |
michael@0 | 29 | #ifndef _STLP_CSTDDEF |
michael@0 | 30 | # include <cstddef> |
michael@0 | 31 | #endif |
michael@0 | 32 | |
michael@0 | 33 | #if defined (__MSL__) |
michael@0 | 34 | # include <unix.h> /* get the definition of fileno */ |
michael@0 | 35 | #endif |
michael@0 | 36 | |
michael@0 | 37 | _STLP_BEGIN_NAMESPACE |
michael@0 | 38 | |
michael@0 | 39 | #if defined (_STLP_WCE) |
michael@0 | 40 | |
michael@0 | 41 | inline int _FILE_fd(const FILE *__f) { |
michael@0 | 42 | /* Check if FILE is one of the three standard streams |
michael@0 | 43 | We do this check first, because invoking _fileno() on one of them |
michael@0 | 44 | causes a terminal window to be created. This also happens if you do |
michael@0 | 45 | any IO on them, but merely retrieving the filedescriptor shouldn't |
michael@0 | 46 | already do that. |
michael@0 | 47 | |
michael@0 | 48 | Obviously this is pretty implementation-specific because it requires |
michael@0 | 49 | that indeed the first three FDs are always the same, but that is not |
michael@0 | 50 | only common but almost guaranteed. */ |
michael@0 | 51 | for (int __fd = 0; __fd != 3; ++__fd) { |
michael@0 | 52 | if (__f == _getstdfilex(__fd)) |
michael@0 | 53 | return __fd; |
michael@0 | 54 | } |
michael@0 | 55 | |
michael@0 | 56 | /* Normal files. */ |
michael@0 | 57 | return (int)::_fileno((FILE*)__f); |
michael@0 | 58 | } |
michael@0 | 59 | |
michael@0 | 60 | # elif defined (_STLP_SCO_OPENSERVER) || defined (__NCR_SVR) |
michael@0 | 61 | |
michael@0 | 62 | inline int _FILE_fd(const FILE *__f) { return __f->__file; } |
michael@0 | 63 | |
michael@0 | 64 | # elif defined (__sun) && defined (_LP64) |
michael@0 | 65 | |
michael@0 | 66 | inline int _FILE_fd(const FILE *__f) { return (int) __f->__pad[2]; } |
michael@0 | 67 | |
michael@0 | 68 | #elif defined (__hpux) /* && defined(__hppa) && defined(__HP_aCC)) */ || \ |
michael@0 | 69 | defined (__MVS__) || \ |
michael@0 | 70 | defined (_STLP_USE_UCLIBC) /* should be before _STLP_USE_GLIBC */ |
michael@0 | 71 | |
michael@0 | 72 | inline int _FILE_fd(const FILE *__f) { return fileno(__CONST_CAST(FILE*, __f)); } |
michael@0 | 73 | |
michael@0 | 74 | #elif defined (_STLP_USE_GLIBC) |
michael@0 | 75 | |
michael@0 | 76 | inline int _FILE_fd(const FILE *__f) { return __f->_fileno; } |
michael@0 | 77 | |
michael@0 | 78 | #elif defined (__BORLANDC__) |
michael@0 | 79 | |
michael@0 | 80 | inline int _FILE_fd(const FILE *__f) { return __f->fd; } |
michael@0 | 81 | |
michael@0 | 82 | #elif defined (__MWERKS__) |
michael@0 | 83 | |
michael@0 | 84 | /* using MWERKS-specific defines here to detect other OS targets |
michael@0 | 85 | * dwa: I'm not sure they provide fileno for all OS's, but this should |
michael@0 | 86 | * work for Win32 and WinCE |
michael@0 | 87 | |
michael@0 | 88 | * Hmm, at least for Novell NetWare __dest_os == __mac_os true too.. |
michael@0 | 89 | * May be both __dest_os and __mac_os defined and empty? - ptr */ |
michael@0 | 90 | # if __dest_os == __mac_os |
michael@0 | 91 | inline int _FILE_fd(const FILE *__f) { return ::fileno(__CONST_CAST(FILE*, __f)); } |
michael@0 | 92 | # else |
michael@0 | 93 | inline int _FILE_fd(const FILE *__f) { return ::_fileno(__CONST_CAST(FILE*, __f)); } |
michael@0 | 94 | # endif |
michael@0 | 95 | |
michael@0 | 96 | #elif defined (__QNXNTO__) || defined (__WATCOMC__) || defined (__EMX__) |
michael@0 | 97 | |
michael@0 | 98 | inline int _FILE_fd(const FILE *__f) { return __f->_handle; } |
michael@0 | 99 | |
michael@0 | 100 | #elif defined (__Lynx__) |
michael@0 | 101 | |
michael@0 | 102 | /* the prototypes are taken from LynxOS patch for STLport 4.0 */ |
michael@0 | 103 | inline int _FILE_fd(const FILE *__f) { return __f->_fd; } |
michael@0 | 104 | |
michael@0 | 105 | #else /* The most common access to file descriptor. */ |
michael@0 | 106 | |
michael@0 | 107 | inline int _FILE_fd(const FILE *__f) { return __f->_file; } |
michael@0 | 108 | |
michael@0 | 109 | #endif |
michael@0 | 110 | |
michael@0 | 111 | _STLP_END_NAMESPACE |
michael@0 | 112 | |
michael@0 | 113 | #endif /* _STLP_STDIO_FILE_H */ |
michael@0 | 114 | |
michael@0 | 115 | /* Local Variables: |
michael@0 | 116 | * mode:C++ |
michael@0 | 117 | * End: */ |