Changeset 76041 in webkit
- Timestamp:
- Jan 18, 2011 11:15:03 AM (13 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r76039 r76041 1 2011-01-18 Adam Roben <aroben@apple.com> 2 3 Call alternate CFHTTPCookie functions if available 4 5 Fixes <http://webkit.org/b/52637> <rdar://problem/8878984>. 6 7 Reviewed by Darin Adler. 8 9 * platform/network/cf/CookieJarCFNet.cpp: Added soft-linking macros to 10 pull in the alternate CFHTTPCookie functions. 11 12 (WebCore::cookieDomain): 13 (WebCore::cookieExpirationTime): 14 (WebCore::cookieName): 15 (WebCore::cookiePath): 16 (WebCore::cookieValue): 17 Added these wrappers around the CFHTTPCookie functions. We call the 18 alternate functions if they exist, otherwise fall back to the current 19 functions. 20 21 (WebCore::filterCookies): 22 (WebCore::getRawCookies): 23 (WebCore::deleteCookie): 24 Changed to use the wrapper functions. 25 1 26 2011-01-18 Martin Robinson <mrobinson@igalia.com> 2 27 -
trunk/Source/WebCore/platform/network/cf/CookieJarCFNet.cpp
r74943 r76041 35 35 #include "PlatformString.h" 36 36 #include "ResourceHandle.h" 37 #include "SoftLinking.h" 37 38 #include <CFNetwork/CFHTTPCookiesPriv.h> 38 39 #include <CoreFoundation/CoreFoundation.h> … … 45 46 static const CFStringRef s_cookieCF = CFSTR("Cookie"); 46 47 48 #ifdef DEBUG_ALL 49 SOFT_LINK_DEBUG_LIBRARY(CFNetwork) 50 #else 51 SOFT_LINK_LIBRARY(CFNetwork) 52 #endif 53 54 SOFT_LINK_OPTIONAL(CFNetwork, CFHTTPCookieCopyDomain, CFStringRef, __cdecl, (CFHTTPCookieRef)) 55 SOFT_LINK_OPTIONAL(CFNetwork, CFHTTPCookieGetExpirationTime, CFAbsoluteTime, __cdecl, (CFHTTPCookieRef)) 56 SOFT_LINK_OPTIONAL(CFNetwork, CFHTTPCookieCopyName, CFStringRef, __cdecl, (CFHTTPCookieRef)) 57 SOFT_LINK_OPTIONAL(CFNetwork, CFHTTPCookieCopyPath, CFStringRef, __cdecl, (CFHTTPCookieRef)) 58 SOFT_LINK_OPTIONAL(CFNetwork, CFHTTPCookieCopyValue, CFStringRef, __cdecl, (CFHTTPCookieRef)) 59 60 static inline RetainPtr<CFStringRef> cookieDomain(CFHTTPCookieRef cookie) 61 { 62 if (CFHTTPCookieCopyDomainPtr()) 63 return RetainPtr<CFStringRef>(AdoptCF, CFHTTPCookieCopyDomainPtr()(cookie)); 64 return CFHTTPCookieGetDomain(cookie); 65 } 66 67 static inline CFAbsoluteTime cookieExpirationTime(CFHTTPCookieRef cookie) 68 { 69 if (CFHTTPCookieGetExpirationTimePtr()) 70 return CFHTTPCookieGetExpirationTimePtr()(cookie); 71 return CFDateGetAbsoluteTime(CFHTTPCookieGetExpiratonDate(cookie)); 72 } 73 74 static inline RetainPtr<CFStringRef> cookieName(CFHTTPCookieRef cookie) 75 { 76 if (CFHTTPCookieCopyNamePtr()) 77 return RetainPtr<CFStringRef>(AdoptCF, CFHTTPCookieCopyNamePtr()(cookie)); 78 return CFHTTPCookieGetName(cookie); 79 } 80 81 static inline RetainPtr<CFStringRef> cookiePath(CFHTTPCookieRef cookie) 82 { 83 if (CFHTTPCookieCopyPathPtr()) 84 return RetainPtr<CFStringRef>(AdoptCF, CFHTTPCookieCopyPathPtr()(cookie)); 85 return CFHTTPCookieGetPath(cookie); 86 } 87 88 static inline RetainPtr<CFStringRef> cookieValue(CFHTTPCookieRef cookie) 89 { 90 if (CFHTTPCookieCopyValuePtr()) 91 return RetainPtr<CFStringRef>(AdoptCF, CFHTTPCookieCopyValuePtr()(cookie)); 92 return CFHTTPCookieGetValue(cookie); 93 } 94 47 95 static RetainPtr<CFArrayRef> filterCookies(CFArrayRef unfilteredCookies) 48 96 { … … 56 104 // that, but we also need to avoid sending cookies that were previously stored, and 57 105 // there's no harm to doing this check because such a cookie is never valid. 58 if (!CFStringGetLength( CFHTTPCookieGetName(cookie)))106 if (!CFStringGetLength(cookieName(cookie).get())) 59 107 continue; 60 108 … … 148 196 for (CFIndex i = 0; i < count; i++) { 149 197 CFHTTPCookieRef cookie = (CFHTTPCookieRef)CFArrayGetValueAtIndex(cookiesCF.get(), i); 150 String name = CFHTTPCookieGetName(cookie);151 String value = CFHTTPCookieGetValue(cookie);152 String domain = CFHTTPCookieGetDomain(cookie);153 String path = CFHTTPCookieGetPath(cookie);154 155 double expires = ( CFDateGetAbsoluteTime(CFHTTPCookieGetExpiratonDate(cookie)) + kCFAbsoluteTimeIntervalSince1970) * 1000;198 String name = cookieName(cookie).get(); 199 String value = cookieValue(cookie).get(); 200 String domain = cookieDomain(cookie).get(); 201 String path = cookiePath(cookie).get(); 202 203 double expires = (cookieExpirationTime(cookie) + kCFAbsoluteTimeIntervalSince1970) * 1000; 156 204 157 205 bool httpOnly = CFHTTPCookieIsHTTPOnly(cookie); … … 179 227 for (CFIndex i = 0; i < count; i++) { 180 228 CFHTTPCookieRef cookie = (CFHTTPCookieRef)CFArrayGetValueAtIndex(cookiesCF.get(), i); 181 String cookieName = CFHTTPCookieGetName(cookie); 182 if (cookieName == name) { 229 if (String(cookieName(cookie).get()) == name) { 183 230 CFHTTPCookieStorageDeleteCookie(cookieStorage, cookie); 184 231 break;
Note: See TracChangeset
for help on using the changeset viewer.