[SCM] WebKit Debian packaging branch, webkit-1.3, updated. upstream/1.3.7-4207-g178b198

aroben at apple.com aroben at apple.com
Sun Feb 20 23:11:04 UTC 2011


The following commit has been merged in the webkit-1.3 branch:
commit f367cb5f2bd62e6f17b5b9b2b259a00a8963389d
Author: aroben at apple.com <aroben at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Jan 18 19:15:03 2011 +0000

    Call alternate CFHTTPCookie functions if available
    
    Fixes <http://webkit.org/b/52637> <rdar://problem/8878984>.
    
    Reviewed by Darin Adler.
    
    * platform/network/cf/CookieJarCFNet.cpp: Added soft-linking macros to
    pull in the alternate CFHTTPCookie functions.
    
    (WebCore::cookieDomain):
    (WebCore::cookieExpirationTime):
    (WebCore::cookieName):
    (WebCore::cookiePath):
    (WebCore::cookieValue):
    Added these wrappers around the CFHTTPCookie functions. We call the
    alternate functions if they exist, otherwise fall back to the current
    functions.
    
    (WebCore::filterCookies):
    (WebCore::getRawCookies):
    (WebCore::deleteCookie):
    Changed to use the wrapper functions.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@76041 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog
index a8fd896..c274545 100644
--- a/Source/WebCore/ChangeLog
+++ b/Source/WebCore/ChangeLog
@@ -1,3 +1,28 @@
+2011-01-18  Adam Roben  <aroben at apple.com>
+
+        Call alternate CFHTTPCookie functions if available
+
+        Fixes <http://webkit.org/b/52637> <rdar://problem/8878984>.
+
+        Reviewed by Darin Adler.
+
+        * platform/network/cf/CookieJarCFNet.cpp: Added soft-linking macros to
+        pull in the alternate CFHTTPCookie functions.
+
+        (WebCore::cookieDomain):
+        (WebCore::cookieExpirationTime):
+        (WebCore::cookieName):
+        (WebCore::cookiePath):
+        (WebCore::cookieValue):
+        Added these wrappers around the CFHTTPCookie functions. We call the
+        alternate functions if they exist, otherwise fall back to the current
+        functions.
+
+        (WebCore::filterCookies):
+        (WebCore::getRawCookies):
+        (WebCore::deleteCookie):
+        Changed to use the wrapper functions.
+
 2011-01-18  Martin Robinson  <mrobinson at igalia.com>
 
         Reviewed by Eric Seidel.
diff --git a/Source/WebCore/platform/network/cf/CookieJarCFNet.cpp b/Source/WebCore/platform/network/cf/CookieJarCFNet.cpp
index 659b719..c6d513a 100644
--- a/Source/WebCore/platform/network/cf/CookieJarCFNet.cpp
+++ b/Source/WebCore/platform/network/cf/CookieJarCFNet.cpp
@@ -34,6 +34,7 @@
 #include "KURL.h"
 #include "PlatformString.h"
 #include "ResourceHandle.h"
+#include "SoftLinking.h"
 #include <CFNetwork/CFHTTPCookiesPriv.h>
 #include <CoreFoundation/CoreFoundation.h>
 #include <WebKitSystemInterface/WebKitSystemInterface.h>
@@ -44,6 +45,53 @@ namespace WebCore {
 static const CFStringRef s_setCookieKeyCF = CFSTR("Set-Cookie");
 static const CFStringRef s_cookieCF = CFSTR("Cookie");
 
+#ifdef DEBUG_ALL
+SOFT_LINK_DEBUG_LIBRARY(CFNetwork)
+#else
+SOFT_LINK_LIBRARY(CFNetwork)
+#endif
+
+SOFT_LINK_OPTIONAL(CFNetwork, CFHTTPCookieCopyDomain, CFStringRef, __cdecl, (CFHTTPCookieRef))
+SOFT_LINK_OPTIONAL(CFNetwork, CFHTTPCookieGetExpirationTime, CFAbsoluteTime, __cdecl, (CFHTTPCookieRef))
+SOFT_LINK_OPTIONAL(CFNetwork, CFHTTPCookieCopyName, CFStringRef, __cdecl, (CFHTTPCookieRef))
+SOFT_LINK_OPTIONAL(CFNetwork, CFHTTPCookieCopyPath, CFStringRef, __cdecl, (CFHTTPCookieRef))
+SOFT_LINK_OPTIONAL(CFNetwork, CFHTTPCookieCopyValue, CFStringRef, __cdecl, (CFHTTPCookieRef))
+
+static inline RetainPtr<CFStringRef> cookieDomain(CFHTTPCookieRef cookie)
+{
+    if (CFHTTPCookieCopyDomainPtr())
+        return RetainPtr<CFStringRef>(AdoptCF, CFHTTPCookieCopyDomainPtr()(cookie));
+    return CFHTTPCookieGetDomain(cookie);
+}
+
+static inline CFAbsoluteTime cookieExpirationTime(CFHTTPCookieRef cookie)
+{
+    if (CFHTTPCookieGetExpirationTimePtr())
+        return CFHTTPCookieGetExpirationTimePtr()(cookie);
+    return CFDateGetAbsoluteTime(CFHTTPCookieGetExpiratonDate(cookie));
+}
+
+static inline RetainPtr<CFStringRef> cookieName(CFHTTPCookieRef cookie)
+{
+    if (CFHTTPCookieCopyNamePtr())
+        return RetainPtr<CFStringRef>(AdoptCF, CFHTTPCookieCopyNamePtr()(cookie));
+    return CFHTTPCookieGetName(cookie);
+}
+
+static inline RetainPtr<CFStringRef> cookiePath(CFHTTPCookieRef cookie)
+{
+    if (CFHTTPCookieCopyPathPtr())
+        return RetainPtr<CFStringRef>(AdoptCF, CFHTTPCookieCopyPathPtr()(cookie));
+    return CFHTTPCookieGetPath(cookie);
+}
+
+static inline RetainPtr<CFStringRef> cookieValue(CFHTTPCookieRef cookie)
+{
+    if (CFHTTPCookieCopyValuePtr())
+        return RetainPtr<CFStringRef>(AdoptCF, CFHTTPCookieCopyValuePtr()(cookie));
+    return CFHTTPCookieGetValue(cookie);
+}
+
 static RetainPtr<CFArrayRef> filterCookies(CFArrayRef unfilteredCookies)
 {
     CFIndex count = CFArrayGetCount(unfilteredCookies);
@@ -55,7 +103,7 @@ static RetainPtr<CFArrayRef> filterCookies(CFArrayRef unfilteredCookies)
         // which would be sent as "Cookie: =". We have a workaround in setCookies() to prevent
         // that, but we also need to avoid sending cookies that were previously stored, and
         // there's no harm to doing this check because such a cookie is never valid.
-        if (!CFStringGetLength(CFHTTPCookieGetName(cookie)))
+        if (!CFStringGetLength(cookieName(cookie).get()))
             continue;
 
         if (CFHTTPCookieIsHTTPOnly(cookie))
@@ -147,12 +195,12 @@ bool getRawCookies(const Document*, const KURL& url, Vector<Cookie>& rawCookies)
 
     for (CFIndex i = 0; i < count; i++) {
        CFHTTPCookieRef cookie = (CFHTTPCookieRef)CFArrayGetValueAtIndex(cookiesCF.get(), i);
-       String name = CFHTTPCookieGetName(cookie);
-       String value = CFHTTPCookieGetValue(cookie);
-       String domain = CFHTTPCookieGetDomain(cookie);
-       String path = CFHTTPCookieGetPath(cookie);
+       String name = cookieName(cookie).get();
+       String value = cookieValue(cookie).get();
+       String domain = cookieDomain(cookie).get();
+       String path = cookiePath(cookie).get();
 
-       double expires = (CFDateGetAbsoluteTime(CFHTTPCookieGetExpiratonDate(cookie)) + kCFAbsoluteTimeIntervalSince1970) * 1000;
+       double expires = (cookieExpirationTime(cookie) + kCFAbsoluteTimeIntervalSince1970) * 1000;
 
        bool httpOnly = CFHTTPCookieIsHTTPOnly(cookie);
        bool secure = CFHTTPCookieIsSecure(cookie);
@@ -178,8 +226,7 @@ void deleteCookie(const Document*, const KURL& url, const String& name)
     CFIndex count = CFArrayGetCount(cookiesCF.get());
     for (CFIndex i = 0; i < count; i++) {
         CFHTTPCookieRef cookie = (CFHTTPCookieRef)CFArrayGetValueAtIndex(cookiesCF.get(), i);
-        String cookieName = CFHTTPCookieGetName(cookie);
-        if (cookieName == name) {
+        if (String(cookieName(cookie).get()) == name) {
             CFHTTPCookieStorageDeleteCookie(cookieStorage, cookie);
             break;
         }

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list