[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc
aroben at apple.com
aroben at apple.com
Wed Dec 22 14:52:32 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit 1166d45c622c666deb3989b11ff6fb507787af8d
Author: aroben at apple.com <aroben at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Fri Oct 22 21:16:26 2010 +0000
Windows build fix
r70319 added Windows-native versions of the various platform/network
headers to platform/network/win. WebCoreGenerated was copying these
headers over the CFNetwork-specific versions in $WebKitOutputDir,
leading to the wrong headers being used in WebKit.
This patch changes WebCoreGenerated not to copy any headers from
platform/network/win into $WebKitOutputDir. Instead, only headers from
platform/network/cf or platform/network/curl (as specified) are copied.
There were some CFNetwork-specific files still hanging around in
platform/network/win; these have been moved to platform/network/cf.
* WebCore.vcproj/WebCore.vcproj: Updated for file moves and let VS
* format the file as it saw fit.
* WebCore.vcproj/WebCoreGenerated.vcproj: Added the various scripts
* this project uses to make editing them easier.
* WebCore.vcproj/copyForwardingHeaders.cmd: Changed not to copy any
* headers from platform/network/win.
* platform/network/cf/CookieJarCFNet.cpp: Renamed from WebCore/platform/network/win/CookieJarCFNetWin.cpp.
* platform/network/cf/CookieStorageCFNet.cpp: Renamed from WebCore/platform/network/win/CookieStorageWin.cpp.
* platform/network/cf/CookieStorageCFNet.h: Renamed from WebCore/platform/network/win/CookieStorageWin.h.
* platform/network/cf/ResourceHandleCFNet.cpp: Updated for rename.
* platform/network/cf/AuthenticationChallenge.h:
* platform/network/cf/ResourceError.h:
* platform/network/cf/ResourceRequest.h:
* platform/network/cf/ResourceResponse.h:
* platform/network/cf/SocketStreamError.h:
* platform/network/cf/SocketStreamHandle.h:
Touched to force a re-copy.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@70339 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 9e9ad86..38e596f 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,41 @@
+2010-10-22 Adam Roben <aroben at apple.com>
+
+ Windows build fix
+
+ r70319 added Windows-native versions of the various platform/network
+ headers to platform/network/win. WebCoreGenerated was copying these
+ headers over the CFNetwork-specific versions in $WebKitOutputDir,
+ leading to the wrong headers being used in WebKit.
+
+ This patch changes WebCoreGenerated not to copy any headers from
+ platform/network/win into $WebKitOutputDir. Instead, only headers from
+ platform/network/cf or platform/network/curl (as specified) are copied.
+ There were some CFNetwork-specific files still hanging around in
+ platform/network/win; these have been moved to platform/network/cf.
+
+ * WebCore.vcproj/WebCore.vcproj: Updated for file moves and let VS
+ * format the file as it saw fit.
+
+ * WebCore.vcproj/WebCoreGenerated.vcproj: Added the various scripts
+ * this project uses to make editing them easier.
+
+ * WebCore.vcproj/copyForwardingHeaders.cmd: Changed not to copy any
+ * headers from platform/network/win.
+
+ * platform/network/cf/CookieJarCFNet.cpp: Renamed from WebCore/platform/network/win/CookieJarCFNetWin.cpp.
+ * platform/network/cf/CookieStorageCFNet.cpp: Renamed from WebCore/platform/network/win/CookieStorageWin.cpp.
+ * platform/network/cf/CookieStorageCFNet.h: Renamed from WebCore/platform/network/win/CookieStorageWin.h.
+
+ * platform/network/cf/ResourceHandleCFNet.cpp: Updated for rename.
+
+ * platform/network/cf/AuthenticationChallenge.h:
+ * platform/network/cf/ResourceError.h:
+ * platform/network/cf/ResourceRequest.h:
+ * platform/network/cf/ResourceResponse.h:
+ * platform/network/cf/SocketStreamError.h:
+ * platform/network/cf/SocketStreamHandle.h:
+ Touched to force a re-copy.
+
2010-10-22 Abhishek Arya <inferno at chromium.org>
Reviewed by Dave Hyatt.
diff --git a/WebCore/WebCore.vcproj/WebCore.vcproj b/WebCore/WebCore.vcproj/WebCore.vcproj
index 0d9c224..bd669fa 100644
--- a/WebCore/WebCore.vcproj/WebCore.vcproj
+++ b/WebCore/WebCore.vcproj/WebCore.vcproj
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="Windows-1252"?>
+<?xml version="1.0" encoding="windows-1251"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8.00"
@@ -27725,7 +27725,7 @@
</FileConfiguration>
</File>
<File
- RelativePath="..\platform\network\cf\CredentialStorageCFNet.cpp"
+ RelativePath="..\platform\network\cf\CookieJarCFNet.cpp"
>
<FileConfiguration
Name="Debug_Cairo|Win32"
@@ -27745,7 +27745,7 @@
</FileConfiguration>
</File>
<File
- RelativePath="..\platform\network\cf\DNSCFNet.cpp"
+ RelativePath="..\platform\network\cf\CookieStorageCFNet.cpp"
>
<FileConfiguration
Name="Debug_Cairo|Win32"
@@ -27765,7 +27765,11 @@
</FileConfiguration>
</File>
<File
- RelativePath="..\platform\network\cf\FormDataStreamCFNet.cpp"
+ RelativePath="..\platform\network\cf\CookieStorageCFNet.h"
+ >
+ </File>
+ <File
+ RelativePath="..\platform\network\cf\CredentialStorageCFNet.cpp"
>
<FileConfiguration
Name="Debug_Cairo|Win32"
@@ -27785,14 +27789,14 @@
</FileConfiguration>
</File>
<File
- RelativePath="..\platform\network\cf\FormDataStreamCFNet.h"
+ RelativePath="..\platform\network\cf\DNSCFNet.cpp"
>
<FileConfiguration
Name="Debug_Cairo|Win32"
ExcludedFromBuild="true"
>
<Tool
- Name="VCCustomBuildTool"
+ Name="VCCLCompilerTool"
/>
</FileConfiguration>
<FileConfiguration
@@ -27800,20 +27804,12 @@
ExcludedFromBuild="true"
>
<Tool
- Name="VCCustomBuildTool"
+ Name="VCCLCompilerTool"
/>
</FileConfiguration>
</File>
<File
- RelativePath="..\platform\network\cf\LoaderRunLoopCF.cpp"
- >
- </File>
- <File
- RelativePath="..\platform\network\cf\LoaderRunLoopCF.h"
- >
- </File>
- <File
- RelativePath="..\platform\network\cf\ProxyServerCFNet.cpp"
+ RelativePath="..\platform\network\cf\FormDataStreamCFNet.cpp"
>
<FileConfiguration
Name="Debug_Cairo|Win32"
@@ -27833,7 +27829,7 @@
</FileConfiguration>
</File>
<File
- RelativePath="..\platform\network\cf\ResourceError.h"
+ RelativePath="..\platform\network\cf\FormDataStreamCFNet.h"
>
<FileConfiguration
Name="Debug_Cairo|Win32"
@@ -27853,27 +27849,15 @@
</FileConfiguration>
</File>
<File
- RelativePath="..\platform\network\cf\ResourceErrorCF.cpp"
+ RelativePath="..\platform\network\cf\LoaderRunLoopCF.cpp"
>
- <FileConfiguration
- Name="Debug_Cairo|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release_Cairo|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
</File>
<File
- RelativePath="..\platform\network\cf\ResourceHandleCFNet.cpp"
+ RelativePath="..\platform\network\cf\LoaderRunLoopCF.h"
+ >
+ </File>
+ <File
+ RelativePath="..\platform\network\cf\ProxyServerCFNet.cpp"
>
<FileConfiguration
Name="Debug_Cairo|Win32"
@@ -27893,7 +27877,7 @@
</FileConfiguration>
</File>
<File
- RelativePath="..\platform\network\cf\ResourceRequest.h"
+ RelativePath="..\platform\network\cf\ResourceError.h"
>
<FileConfiguration
Name="Debug_Cairo|Win32"
@@ -27913,7 +27897,7 @@
</FileConfiguration>
</File>
<File
- RelativePath="..\platform\network\cf\ResourceRequestCFNet.cpp"
+ RelativePath="..\platform\network\cf\ResourceErrorCF.cpp"
>
<FileConfiguration
Name="Debug_Cairo|Win32"
@@ -27933,14 +27917,14 @@
</FileConfiguration>
</File>
<File
- RelativePath="..\platform\network\cf\ResourceRequestCFNet.h"
+ RelativePath="..\platform\network\cf\ResourceHandleCFNet.cpp"
>
<FileConfiguration
Name="Debug_Cairo|Win32"
ExcludedFromBuild="true"
>
<Tool
- Name="VCCustomBuildTool"
+ Name="VCCLCompilerTool"
/>
</FileConfiguration>
<FileConfiguration
@@ -27948,12 +27932,12 @@
ExcludedFromBuild="true"
>
<Tool
- Name="VCCustomBuildTool"
+ Name="VCCLCompilerTool"
/>
</FileConfiguration>
</File>
<File
- RelativePath="..\platform\network\cf\ResourceResponse.h"
+ RelativePath="..\platform\network\cf\ResourceRequest.h"
>
<FileConfiguration
Name="Debug_Cairo|Win32"
@@ -27973,7 +27957,7 @@
</FileConfiguration>
</File>
<File
- RelativePath="..\platform\network\cf\ResourceResponseCFNet.cpp"
+ RelativePath="..\platform\network\cf\ResourceRequestCFNet.cpp"
>
<FileConfiguration
Name="Debug_Cairo|Win32"
@@ -27993,14 +27977,14 @@
</FileConfiguration>
</File>
<File
- RelativePath="..\platform\network\cf\SocketStreamError.h"
+ RelativePath="..\platform\network\cf\ResourceRequestCFNet.h"
>
<FileConfiguration
Name="Debug_Cairo|Win32"
ExcludedFromBuild="true"
>
<Tool
- Name="VCCLCompilerTool"
+ Name="VCCustomBuildTool"
/>
</FileConfiguration>
<FileConfiguration
@@ -28008,19 +27992,19 @@
ExcludedFromBuild="true"
>
<Tool
- Name="VCCLCompilerTool"
+ Name="VCCustomBuildTool"
/>
</FileConfiguration>
</File>
<File
- RelativePath="..\platform\network\cf\SocketStreamHandle.h"
+ RelativePath="..\platform\network\cf\ResourceResponse.h"
>
<FileConfiguration
Name="Debug_Cairo|Win32"
ExcludedFromBuild="true"
>
<Tool
- Name="VCCLCompilerTool"
+ Name="VCCustomBuildTool"
/>
</FileConfiguration>
<FileConfiguration
@@ -28028,12 +28012,12 @@
ExcludedFromBuild="true"
>
<Tool
- Name="VCCLCompilerTool"
+ Name="VCCustomBuildTool"
/>
</FileConfiguration>
</File>
<File
- RelativePath="..\platform\network\cf\SocketStreamHandleCFNet.cpp"
+ RelativePath="..\platform\network\cf\ResourceResponseCFNet.cpp"
>
<FileConfiguration
Name="Debug_Cairo|Win32"
@@ -28052,12 +28036,8 @@
/>
</FileConfiguration>
</File>
- </Filter>
- <Filter
- Name="win"
- >
<File
- RelativePath="..\platform\network\win\CookieJarCFNetWin.cpp"
+ RelativePath="..\platform\network\cf\SocketStreamError.h"
>
<FileConfiguration
Name="Debug_Cairo|Win32"
@@ -28077,7 +28057,7 @@
</FileConfiguration>
</File>
<File
- RelativePath="..\platform\network\win\CookieStorageWin.cpp"
+ RelativePath="..\platform\network\cf\SocketStreamHandle.h"
>
<FileConfiguration
Name="Debug_Cairo|Win32"
@@ -28097,7 +28077,7 @@
</FileConfiguration>
</File>
<File
- RelativePath="..\platform\network\win\CookieStorageWin.h"
+ RelativePath="..\platform\network\cf\SocketStreamHandleCFNet.cpp"
>
<FileConfiguration
Name="Debug_Cairo|Win32"
@@ -28116,6 +28096,10 @@
/>
</FileConfiguration>
</File>
+ </Filter>
+ <Filter
+ Name="win"
+ >
<File
RelativePath="..\platform\network\win\NetworkStateNotifierWin.cpp"
>
@@ -42151,6 +42135,10 @@
>
</File>
<File
+ RelativePath="..\dom\IgnoreDestructiveWriteCountIncrementer.h"
+ >
+ </File>
+ <File
RelativePath="..\dom\InputElement.cpp"
>
<FileConfiguration
@@ -42203,10 +42191,6 @@
</FileConfiguration>
</File>
<File
- RelativePath="..\dom\IgnoreDestructiveWriteCountIncrementer.h"
- >
- </File>
- <File
RelativePath="..\dom\InputElement.h"
>
</File>
@@ -62218,43 +62202,43 @@
Name="properties"
>
<File
- RelativePath="..\svg\properties\SVGAnimatedListPropertyTearOff.h"
+ RelativePath="..\svg\properties\SVGAnimatedListPropertyTearOff.h"
>
</File>
<File
- RelativePath="..\svg\properties\SVGAnimatedProperty.h"
+ RelativePath="..\svg\properties\SVGAnimatedProperty.h"
>
</File>
<File
- RelativePath="..\svg\properties\SVGAnimatedPropertyDescription.h"
+ RelativePath="..\svg\properties\SVGAnimatedPropertyDescription.h"
>
</File>
<File
- RelativePath="..\svg\properties\SVGAnimatedPropertyMacros.h"
+ RelativePath="..\svg\properties\SVGAnimatedPropertyMacros.h"
>
</File>
<File
- RelativePath="..\svg\properties\SVGAnimatedPropertySynchronizer.h"
+ RelativePath="..\svg\properties\SVGAnimatedPropertySynchronizer.h"
>
</File>
<File
- RelativePath="..\svg\properties\SVGAnimatedPropertyTearOff.h"
+ RelativePath="..\svg\properties\SVGAnimatedPropertyTearOff.h"
>
</File>
<File
- RelativePath="..\svg\properties\SVGListPropertyTearOff.h"
+ RelativePath="..\svg\properties\SVGListPropertyTearOff.h"
>
</File>
<File
- RelativePath="..\svg\properties\SVGProperty.h"
+ RelativePath="..\svg\properties\SVGProperty.h"
>
</File>
<File
- RelativePath="..\svg\properties\SVGPropertyTearOff.h"
+ RelativePath="..\svg\properties\SVGPropertyTearOff.h"
>
</File>
<File
- RelativePath="..\svg\properties\SVGPropertyTraits.h"
+ RelativePath="..\svg\properties\SVGPropertyTraits.h"
>
</File>
</Filter>
diff --git a/WebCore/WebCore.vcproj/WebCoreGenerated.vcproj b/WebCore/WebCore.vcproj/WebCoreGenerated.vcproj
index 4f7dcd9..9b891cd 100644
--- a/WebCore/WebCore.vcproj/WebCoreGenerated.vcproj
+++ b/WebCore/WebCore.vcproj/WebCoreGenerated.vcproj
@@ -62,6 +62,18 @@
RelativePath=".\build-generated-files.sh"
>
</File>
+ <File
+ RelativePath=".\copyForwardingHeaders.cmd"
+ >
+ </File>
+ <File
+ RelativePath=".\copyInspectorFiles.cmd"
+ >
+ </File>
+ <File
+ RelativePath=".\migrate-scripts.sh"
+ >
+ </File>
</Files>
<Globals>
</Globals>
diff --git a/WebCore/WebCore.vcproj/copyForwardingHeaders.cmd b/WebCore/WebCore.vcproj/copyForwardingHeaders.cmd
index a85ace3..3885487 100755
--- a/WebCore/WebCore.vcproj/copyForwardingHeaders.cmd
+++ b/WebCore/WebCore.vcproj/copyForwardingHeaders.cmd
@@ -44,7 +44,6 @@ xcopy /y /d "%ProjectDir%..\platform\text\transcoder\*.h" "%WebKitOutputDir%\inc
xcopy /y /d "%ProjectDir%..\platform\win\*.h" "%WebKitOutputDir%\include\WebCore"
xcopy /y /d "%ProjectDir%..\platform\network\*.h" "%WebKitOutputDir%\include\WebCore"
xcopy /y /d "%ProjectDir%..\platform\network\%2\*.h" "%WebKitOutputDir%\include\WebCore"
-xcopy /y /d "%ProjectDir%..\platform\network\win\*.h" "%WebKitOutputDir%\include\WebCore"
xcopy /y /d "%ProjectDir%..\platform\sql\*.h" "%WebKitOutputDir%\include\WebCore"
xcopy /y /d "%ProjectDir%..\platform\cairo\cairo\src\*.h" "%WebKitOutputDir%\include\WebCore"
xcopy /y /d "%ProjectDir%..\bindings\*.h" "%WebKitOutputDir%\include\WebCore"
diff --git a/WebCore/platform/network/cf/AuthenticationChallenge.h b/WebCore/platform/network/cf/AuthenticationChallenge.h
index 58fb836..e7d66de 100644
--- a/WebCore/platform/network/cf/AuthenticationChallenge.h
+++ b/WebCore/platform/network/cf/AuthenticationChallenge.h
@@ -22,6 +22,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+
#ifndef AuthenticationChallenge_h
#define AuthenticationChallenge_h
diff --git a/WebCore/platform/network/cf/CookieJarCFNet.cpp b/WebCore/platform/network/cf/CookieJarCFNet.cpp
new file mode 100644
index 0000000..d3fc06d
--- /dev/null
+++ b/WebCore/platform/network/cf/CookieJarCFNet.cpp
@@ -0,0 +1,187 @@
+/*
+ * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "CookieJar.h"
+
+#include "Cookie.h"
+#include "CookieStorageCFNet.h"
+#include "Document.h"
+#include "KURL.h"
+#include "PlatformString.h"
+#include "ResourceHandle.h"
+#include <CFNetwork/CFHTTPCookiesPriv.h>
+#include <CoreFoundation/CoreFoundation.h>
+#include <WebKitSystemInterface/WebKitSystemInterface.h>
+#include <windows.h>
+
+namespace WebCore {
+
+static const CFStringRef s_setCookieKeyCF = CFSTR("Set-Cookie");
+static const CFStringRef s_cookieCF = CFSTR("Cookie");
+
+static RetainPtr<CFArrayRef> filterCookies(CFArrayRef unfilteredCookies)
+{
+ CFIndex count = CFArrayGetCount(unfilteredCookies);
+ RetainPtr<CFMutableArrayRef> filteredCookies(AdoptCF, CFArrayCreateMutable(0, count, &kCFTypeArrayCallBacks));
+ for (CFIndex i = 0; i < count; ++i) {
+ CFHTTPCookieRef cookie = (CFHTTPCookieRef)CFArrayGetValueAtIndex(unfilteredCookies, i);
+
+ // <rdar://problem/5632883> CFHTTPCookieStorage would store an empty cookie,
+ // 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)))
+ continue;
+
+ if (CFHTTPCookieIsHTTPOnly(cookie))
+ continue;
+
+ CFArrayAppendValue(filteredCookies.get(), cookie);
+ }
+ return filteredCookies;
+}
+
+void setCookies(Document* document, const KURL& url, const String& value)
+{
+ // <rdar://problem/5632883> CFHTTPCookieStorage stores an empty cookie, which would be sent as "Cookie: =".
+ if (value.isEmpty())
+ return;
+
+ CFHTTPCookieStorageRef cookieStorage = currentCookieStorage();
+ if (!cookieStorage)
+ return;
+
+ RetainPtr<CFURLRef> urlCF(AdoptCF, url.createCFURL());
+ RetainPtr<CFURLRef> firstPartyForCookiesCF(AdoptCF, document->firstPartyForCookies().createCFURL());
+
+ // <http://bugs.webkit.org/show_bug.cgi?id=6531>, <rdar://4409034>
+ // cookiesWithResponseHeaderFields doesn't parse cookies without a value
+ String cookieString = value.contains('=') ? value : value + "=";
+
+ RetainPtr<CFStringRef> cookieStringCF(AdoptCF, cookieString.createCFString());
+ RetainPtr<CFDictionaryRef> headerFieldsCF(AdoptCF, CFDictionaryCreate(kCFAllocatorDefault,
+ (const void**)&s_setCookieKeyCF, (const void**)&cookieStringCF, 1,
+ &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));
+
+ RetainPtr<CFArrayRef> cookiesCF(AdoptCF, CFHTTPCookieCreateWithResponseHeaderFields(kCFAllocatorDefault,
+ headerFieldsCF.get(), urlCF.get()));
+
+ CFHTTPCookieStorageSetCookies(cookieStorage, filterCookies(cookiesCF.get()).get(), urlCF.get(), firstPartyForCookiesCF.get());
+}
+
+String cookies(const Document* /*document*/, const KURL& url)
+{
+ CFHTTPCookieStorageRef cookieStorage = currentCookieStorage();
+ if (!cookieStorage)
+ return String();
+
+ RetainPtr<CFURLRef> urlCF(AdoptCF, url.createCFURL());
+
+ bool secure = url.protocolIs("https");
+ RetainPtr<CFArrayRef> cookiesCF(AdoptCF, CFHTTPCookieStorageCopyCookiesForURL(cookieStorage, urlCF.get(), secure));
+ RetainPtr<CFDictionaryRef> headerCF(AdoptCF, CFHTTPCookieCopyRequestHeaderFields(kCFAllocatorDefault, filterCookies(cookiesCF.get()).get()));
+ return (CFStringRef)CFDictionaryGetValue(headerCF.get(), s_cookieCF);
+}
+
+String cookieRequestHeaderFieldValue(const Document* /*document*/, const KURL& url)
+{
+ CFHTTPCookieStorageRef cookieStorage = currentCookieStorage();
+ if (!cookieStorage)
+ return String();
+
+ RetainPtr<CFURLRef> urlCF(AdoptCF, url.createCFURL());
+
+ bool secure = url.protocolIs("https");
+ RetainPtr<CFArrayRef> cookiesCF(AdoptCF, CFHTTPCookieStorageCopyCookiesForURL(cookieStorage, urlCF.get(), secure));
+ RetainPtr<CFDictionaryRef> headerCF(AdoptCF, CFHTTPCookieCopyRequestHeaderFields(kCFAllocatorDefault, cookiesCF.get()));
+ return (CFStringRef)CFDictionaryGetValue(headerCF.get(), s_cookieCF);
+}
+
+bool cookiesEnabled(const Document* /*document*/)
+{
+ CFHTTPCookieStorageAcceptPolicy policy = CFHTTPCookieStorageAcceptPolicyOnlyFromMainDocumentDomain;
+ if (CFHTTPCookieStorageRef cookieStorage = currentCookieStorage())
+ policy = CFHTTPCookieStorageGetCookieAcceptPolicy(cookieStorage);
+ return policy == CFHTTPCookieStorageAcceptPolicyOnlyFromMainDocumentDomain || policy == CFHTTPCookieStorageAcceptPolicyAlways;
+}
+
+bool getRawCookies(const Document*, const KURL& url, Vector<Cookie>& rawCookies)
+{
+ rawCookies.clear();
+ CFHTTPCookieStorageRef cookieStorage = currentCookieStorage();
+ if (!cookieStorage)
+ return false;
+
+ RetainPtr<CFURLRef> urlCF(AdoptCF, url.createCFURL());
+
+ bool sendSecureCookies = url.protocolIs("https");
+ RetainPtr<CFArrayRef> cookiesCF(AdoptCF, CFHTTPCookieStorageCopyCookiesForURL(cookieStorage, urlCF.get(), sendSecureCookies));
+
+ CFIndex count = CFArrayGetCount(cookiesCF.get());
+ rawCookies.reserveCapacity(count);
+
+ 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);
+
+ double expires = (CFDateGetAbsoluteTime(CFHTTPCookieGetExpiratonDate(cookie)) + kCFAbsoluteTimeIntervalSince1970) * 1000;
+
+ bool httpOnly = CFHTTPCookieIsHTTPOnly(cookie);
+ bool secure = CFHTTPCookieIsSecure(cookie);
+ bool session = false; // FIXME: Need API for if a cookie is a session cookie.
+
+ rawCookies.uncheckedAppend(Cookie(name, value, domain, path, expires, httpOnly, secure, session));
+ }
+
+ return true;
+}
+
+void deleteCookie(const Document*, const KURL& url, const String& name)
+{
+ CFHTTPCookieStorageRef cookieStorage = currentCookieStorage();
+ if (!cookieStorage)
+ return;
+
+ RetainPtr<CFURLRef> urlCF(AdoptCF, url.createCFURL());
+
+ bool sendSecureCookies = url.protocolIs("https");
+ RetainPtr<CFArrayRef> cookiesCF(AdoptCF, CFHTTPCookieStorageCopyCookiesForURL(cookieStorage, urlCF.get(), sendSecureCookies));
+
+ 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) {
+ CFHTTPCookieStorageDeleteCookie(cookieStorage, cookie);
+ break;
+ }
+ }
+}
+
+}
diff --git a/WebCore/platform/network/cf/CookieStorageCFNet.cpp b/WebCore/platform/network/cf/CookieStorageCFNet.cpp
new file mode 100644
index 0000000..aefbcfb
--- /dev/null
+++ b/WebCore/platform/network/cf/CookieStorageCFNet.cpp
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "CookieStorageCFNet.h"
+
+#include <CFNetwork/CFHTTPCookiesPriv.h>
+#include <WebKitSystemInterface/WebKitSystemInterface.h>
+#include <wtf/RetainPtr.h>
+
+namespace WebCore {
+
+static RetainPtr<CFHTTPCookieStorageRef> s_cookieStorage;
+
+CFHTTPCookieStorageRef currentCookieStorage()
+{
+ if (s_cookieStorage)
+ return s_cookieStorage.get();
+ return wkGetDefaultHTTPCookieStorage();
+}
+
+void setCurrentCookieStorage(CFHTTPCookieStorageRef cookieStorage)
+{
+ s_cookieStorage = cookieStorage;
+}
+
+}
diff --git a/WebCore/platform/network/cf/CookieStorageCFNet.h b/WebCore/platform/network/cf/CookieStorageCFNet.h
new file mode 100644
index 0000000..59bc3ce
--- /dev/null
+++ b/WebCore/platform/network/cf/CookieStorageCFNet.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef CookieStorageCFNet_h
+#define CookieStorageCFNet_h
+
+typedef struct OpaqueCFHTTPCookieStorage* CFHTTPCookieStorageRef;
+
+namespace WebCore {
+
+ CFHTTPCookieStorageRef currentCookieStorage();
+
+ void setCurrentCookieStorage(CFHTTPCookieStorageRef cookieStorage);
+
+}
+
+#endif // CookieStorageCFNet_h
diff --git a/WebCore/platform/network/cf/ResourceError.h b/WebCore/platform/network/cf/ResourceError.h
index 10f1208..83f298c 100644
--- a/WebCore/platform/network/cf/ResourceError.h
+++ b/WebCore/platform/network/cf/ResourceError.h
@@ -70,4 +70,4 @@ private:
} // namespace WebCore
-#endif // ResourceError_h_
+#endif // ResourceError_h
diff --git a/WebCore/platform/network/cf/ResourceHandleCFNet.cpp b/WebCore/platform/network/cf/ResourceHandleCFNet.cpp
index 13412c1..e48bd2d 100644
--- a/WebCore/platform/network/cf/ResourceHandleCFNet.cpp
+++ b/WebCore/platform/network/cf/ResourceHandleCFNet.cpp
@@ -32,7 +32,7 @@
#include "AuthenticationCF.h"
#include "AuthenticationChallenge.h"
#include "Base64.h"
-#include "CookieStorageWin.h"
+#include "CookieStorageCFNet.h"
#include "CredentialStorage.h"
#include "CachedResourceLoader.h"
#include "FormDataStreamCFNet.h"
diff --git a/WebCore/platform/network/cf/ResourceRequest.h b/WebCore/platform/network/cf/ResourceRequest.h
index 9ed79f2..0f330d1 100644
--- a/WebCore/platform/network/cf/ResourceRequest.h
+++ b/WebCore/platform/network/cf/ResourceRequest.h
@@ -21,7 +21,7 @@
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef ResourceRequest_h
diff --git a/WebCore/platform/network/cf/ResourceResponse.h b/WebCore/platform/network/cf/ResourceResponse.h
index 5e27670..a586a16 100644
--- a/WebCore/platform/network/cf/ResourceResponse.h
+++ b/WebCore/platform/network/cf/ResourceResponse.h
@@ -22,6 +22,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+
#ifndef ResourceResponse_h
#define ResourceResponse_h
diff --git a/WebCore/platform/network/cf/SocketStreamError.h b/WebCore/platform/network/cf/SocketStreamError.h
index f9641ad..6a0b441 100644
--- a/WebCore/platform/network/cf/SocketStreamError.h
+++ b/WebCore/platform/network/cf/SocketStreamError.h
@@ -35,15 +35,15 @@
namespace WebCore {
- class SocketStreamError : public SocketStreamErrorBase {
- public:
- SocketStreamError() { }
- explicit SocketStreamError(int errorCode)
- : SocketStreamErrorBase(errorCode)
- {
- }
+class SocketStreamError : public SocketStreamErrorBase {
+public:
+ SocketStreamError() { }
+ explicit SocketStreamError(int errorCode)
+ : SocketStreamErrorBase(errorCode)
+ {
+ }
- };
+};
} // namespace WebCore
diff --git a/WebCore/platform/network/cf/SocketStreamHandle.h b/WebCore/platform/network/cf/SocketStreamHandle.h
index 8643db7..41d543a 100644
--- a/WebCore/platform/network/cf/SocketStreamHandle.h
+++ b/WebCore/platform/network/cf/SocketStreamHandle.h
@@ -39,74 +39,74 @@
namespace WebCore {
- class AuthenticationChallenge;
- class Credential;
- class SocketStreamHandleClient;
+class AuthenticationChallenge;
+class Credential;
+class SocketStreamHandleClient;
- class SocketStreamHandle : public RefCounted<SocketStreamHandle>, public SocketStreamHandleBase, public AuthenticationClient {
- public:
- static PassRefPtr<SocketStreamHandle> create(const KURL& url, SocketStreamHandleClient* client) { return adoptRef(new SocketStreamHandle(url, client)); }
+class SocketStreamHandle : public RefCounted<SocketStreamHandle>, public SocketStreamHandleBase, public AuthenticationClient {
+public:
+ static PassRefPtr<SocketStreamHandle> create(const KURL& url, SocketStreamHandleClient* client) { return adoptRef(new SocketStreamHandle(url, client)); }
- virtual ~SocketStreamHandle();
+ virtual ~SocketStreamHandle();
- using RefCounted<SocketStreamHandle>::ref;
- using RefCounted<SocketStreamHandle>::deref;
+ using RefCounted<SocketStreamHandle>::ref;
+ using RefCounted<SocketStreamHandle>::deref;
- private:
- virtual int platformSend(const char* data, int length);
- virtual void platformClose();
+private:
+ virtual int platformSend(const char* data, int length);
+ virtual void platformClose();
- SocketStreamHandle(const KURL&, SocketStreamHandleClient*);
- void createStreams();
- void scheduleStreams();
- void chooseProxy();
+ SocketStreamHandle(const KURL&, SocketStreamHandleClient*);
+ void createStreams();
+ void scheduleStreams();
+ void chooseProxy();
#ifndef BUILDING_ON_TIGER
- void chooseProxyFromArray(CFArrayRef);
- void executePACFileURL(CFURLRef);
- void removePACRunLoopSource();
- RetainPtr<CFRunLoopSourceRef> m_pacRunLoopSource;
- static void pacExecutionCallback(void* client, CFArrayRef proxyList, CFErrorRef error);
- static void pacExecutionCallbackMainThread(void*);
- static CFStringRef copyPACExecutionDescription(void*);
+ void chooseProxyFromArray(CFArrayRef);
+ void executePACFileURL(CFURLRef);
+ void removePACRunLoopSource();
+ RetainPtr<CFRunLoopSourceRef> m_pacRunLoopSource;
+ static void pacExecutionCallback(void* client, CFArrayRef proxyList, CFErrorRef error);
+ static void pacExecutionCallbackMainThread(void*);
+ static CFStringRef copyPACExecutionDescription(void*);
#endif
- bool shouldUseSSL() const { return m_url.protocolIs("wss"); }
+ bool shouldUseSSL() const { return m_url.protocolIs("wss"); }
- void addCONNECTCredentials(CFHTTPMessageRef response);
+ void addCONNECTCredentials(CFHTTPMessageRef response);
- static CFStringRef copyCFStreamDescription(void* );
- static void readStreamCallback(CFReadStreamRef, CFStreamEventType, void*);
- static void writeStreamCallback(CFWriteStreamRef, CFStreamEventType, void*);
+ static CFStringRef copyCFStreamDescription(void* );
+ static void readStreamCallback(CFReadStreamRef, CFStreamEventType, void*);
+ static void writeStreamCallback(CFWriteStreamRef, CFStreamEventType, void*);
#if PLATFORM(WIN)
- static void readStreamCallbackMainThread(void*);
- static void writeStreamCallbackMainThread(void*);
+ static void readStreamCallbackMainThread(void*);
+ static void writeStreamCallbackMainThread(void*);
#endif
- void readStreamCallback(CFStreamEventType);
- void writeStreamCallback(CFStreamEventType);
+ void readStreamCallback(CFStreamEventType);
+ void writeStreamCallback(CFStreamEventType);
- // No authentication for streams per se, but proxy may ask for credentials.
- virtual void receivedCredential(const AuthenticationChallenge&, const Credential&);
- virtual void receivedRequestToContinueWithoutCredential(const AuthenticationChallenge&);
- virtual void receivedCancellation(const AuthenticationChallenge&);
+ // No authentication for streams per se, but proxy may ask for credentials.
+ virtual void receivedCredential(const AuthenticationChallenge&, const Credential&);
+ virtual void receivedRequestToContinueWithoutCredential(const AuthenticationChallenge&);
+ virtual void receivedCancellation(const AuthenticationChallenge&);
- virtual void refAuthenticationClient() { ref(); }
- virtual void derefAuthenticationClient() { deref(); }
+ virtual void refAuthenticationClient() { ref(); }
+ virtual void derefAuthenticationClient() { deref(); }
- enum ConnectingSubstate { New, ExecutingPACFile, WaitingForCredentials, WaitingForConnect, Connected };
- ConnectingSubstate m_connectingSubstate;
+ enum ConnectingSubstate { New, ExecutingPACFile, WaitingForCredentials, WaitingForConnect, Connected };
+ ConnectingSubstate m_connectingSubstate;
- enum ConnectionType { Unknown, Direct, SOCKSProxy, CONNECTProxy };
- ConnectionType m_connectionType;
- RetainPtr<CFStringRef> m_proxyHost;
- RetainPtr<CFNumberRef> m_proxyPort;
+ enum ConnectionType { Unknown, Direct, SOCKSProxy, CONNECTProxy };
+ ConnectionType m_connectionType;
+ RetainPtr<CFStringRef> m_proxyHost;
+ RetainPtr<CFNumberRef> m_proxyPort;
- RetainPtr<CFHTTPMessageRef> m_proxyResponseMessage;
- bool m_sentStoredCredentials;
- RetainPtr<CFReadStreamRef> m_readStream;
- RetainPtr<CFWriteStreamRef> m_writeStream;
+ RetainPtr<CFHTTPMessageRef> m_proxyResponseMessage;
+ bool m_sentStoredCredentials;
+ RetainPtr<CFReadStreamRef> m_readStream;
+ RetainPtr<CFWriteStreamRef> m_writeStream;
- RetainPtr<CFURLRef> m_httpsURL; // ws(s): replaced with https:
- };
+ RetainPtr<CFURLRef> m_httpsURL; // ws(s): replaced with https:
+};
} // namespace WebCore
diff --git a/WebCore/platform/network/win/CookieJarCFNetWin.cpp b/WebCore/platform/network/win/CookieJarCFNetWin.cpp
deleted file mode 100644
index 2a90dfc..0000000
--- a/WebCore/platform/network/win/CookieJarCFNetWin.cpp
+++ /dev/null
@@ -1,188 +0,0 @@
-/*
- * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "CookieJar.h"
-
-#include "Cookie.h"
-#include "CookieStorageWin.h"
-#include "Document.h"
-#include "KURL.h"
-#include "PlatformString.h"
-#include "ResourceHandle.h"
-#include <CFNetwork/CFHTTPCookiesPriv.h>
-#include <CoreFoundation/CoreFoundation.h>
-#include <WebKitSystemInterface/WebKitSystemInterface.h>
-#include <windows.h>
-#include <wtf/RetainPtr.h>
-
-namespace WebCore {
-
-static const CFStringRef s_setCookieKeyCF = CFSTR("Set-Cookie");
-static const CFStringRef s_cookieCF = CFSTR("Cookie");
-
-static RetainPtr<CFArrayRef> filterCookies(CFArrayRef unfilteredCookies)
-{
- CFIndex count = CFArrayGetCount(unfilteredCookies);
- RetainPtr<CFMutableArrayRef> filteredCookies(AdoptCF, CFArrayCreateMutable(0, count, &kCFTypeArrayCallBacks));
- for (CFIndex i = 0; i < count; ++i) {
- CFHTTPCookieRef cookie = (CFHTTPCookieRef)CFArrayGetValueAtIndex(unfilteredCookies, i);
-
- // <rdar://problem/5632883> CFHTTPCookieStorage would store an empty cookie,
- // 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)))
- continue;
-
- if (CFHTTPCookieIsHTTPOnly(cookie))
- continue;
-
- CFArrayAppendValue(filteredCookies.get(), cookie);
- }
- return filteredCookies;
-}
-
-void setCookies(Document* document, const KURL& url, const String& value)
-{
- // <rdar://problem/5632883> CFHTTPCookieStorage stores an empty cookie, which would be sent as "Cookie: =".
- if (value.isEmpty())
- return;
-
- CFHTTPCookieStorageRef cookieStorage = currentCookieStorage();
- if (!cookieStorage)
- return;
-
- RetainPtr<CFURLRef> urlCF(AdoptCF, url.createCFURL());
- RetainPtr<CFURLRef> firstPartyForCookiesCF(AdoptCF, document->firstPartyForCookies().createCFURL());
-
- // <http://bugs.webkit.org/show_bug.cgi?id=6531>, <rdar://4409034>
- // cookiesWithResponseHeaderFields doesn't parse cookies without a value
- String cookieString = value.contains('=') ? value : value + "=";
-
- RetainPtr<CFStringRef> cookieStringCF(AdoptCF, cookieString.createCFString());
- RetainPtr<CFDictionaryRef> headerFieldsCF(AdoptCF, CFDictionaryCreate(kCFAllocatorDefault,
- (const void**)&s_setCookieKeyCF, (const void**)&cookieStringCF, 1,
- &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));
-
- RetainPtr<CFArrayRef> cookiesCF(AdoptCF, CFHTTPCookieCreateWithResponseHeaderFields(kCFAllocatorDefault,
- headerFieldsCF.get(), urlCF.get()));
-
- CFHTTPCookieStorageSetCookies(cookieStorage, filterCookies(cookiesCF.get()).get(), urlCF.get(), firstPartyForCookiesCF.get());
-}
-
-String cookies(const Document* /*document*/, const KURL& url)
-{
- CFHTTPCookieStorageRef cookieStorage = currentCookieStorage();
- if (!cookieStorage)
- return String();
-
- RetainPtr<CFURLRef> urlCF(AdoptCF, url.createCFURL());
-
- bool secure = url.protocolIs("https");
- RetainPtr<CFArrayRef> cookiesCF(AdoptCF, CFHTTPCookieStorageCopyCookiesForURL(cookieStorage, urlCF.get(), secure));
- RetainPtr<CFDictionaryRef> headerCF(AdoptCF, CFHTTPCookieCopyRequestHeaderFields(kCFAllocatorDefault, filterCookies(cookiesCF.get()).get()));
- return (CFStringRef)CFDictionaryGetValue(headerCF.get(), s_cookieCF);
-}
-
-String cookieRequestHeaderFieldValue(const Document* /*document*/, const KURL& url)
-{
- CFHTTPCookieStorageRef cookieStorage = currentCookieStorage();
- if (!cookieStorage)
- return String();
-
- RetainPtr<CFURLRef> urlCF(AdoptCF, url.createCFURL());
-
- bool secure = url.protocolIs("https");
- RetainPtr<CFArrayRef> cookiesCF(AdoptCF, CFHTTPCookieStorageCopyCookiesForURL(cookieStorage, urlCF.get(), secure));
- RetainPtr<CFDictionaryRef> headerCF(AdoptCF, CFHTTPCookieCopyRequestHeaderFields(kCFAllocatorDefault, cookiesCF.get()));
- return (CFStringRef)CFDictionaryGetValue(headerCF.get(), s_cookieCF);
-}
-
-bool cookiesEnabled(const Document* /*document*/)
-{
- CFHTTPCookieStorageAcceptPolicy policy = CFHTTPCookieStorageAcceptPolicyOnlyFromMainDocumentDomain;
- if (CFHTTPCookieStorageRef cookieStorage = currentCookieStorage())
- policy = CFHTTPCookieStorageGetCookieAcceptPolicy(cookieStorage);
- return policy == CFHTTPCookieStorageAcceptPolicyOnlyFromMainDocumentDomain || policy == CFHTTPCookieStorageAcceptPolicyAlways;
-}
-
-bool getRawCookies(const Document*, const KURL& url, Vector<Cookie>& rawCookies)
-{
- rawCookies.clear();
- CFHTTPCookieStorageRef cookieStorage = currentCookieStorage();
- if (!cookieStorage)
- return false;
-
- RetainPtr<CFURLRef> urlCF(AdoptCF, url.createCFURL());
-
- bool sendSecureCookies = url.protocolIs("https");
- RetainPtr<CFArrayRef> cookiesCF(AdoptCF, CFHTTPCookieStorageCopyCookiesForURL(cookieStorage, urlCF.get(), sendSecureCookies));
-
- CFIndex count = CFArrayGetCount(cookiesCF.get());
- rawCookies.reserveCapacity(count);
-
- 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);
-
- double expires = (CFDateGetAbsoluteTime(CFHTTPCookieGetExpiratonDate(cookie)) + kCFAbsoluteTimeIntervalSince1970) * 1000;
-
- bool httpOnly = CFHTTPCookieIsHTTPOnly(cookie);
- bool secure = CFHTTPCookieIsSecure(cookie);
- bool session = false; // FIXME: Need API for if a cookie is a session cookie.
-
- rawCookies.uncheckedAppend(Cookie(name, value, domain, path, expires, httpOnly, secure, session));
- }
-
- return true;
-}
-
-void deleteCookie(const Document*, const KURL& url, const String& name)
-{
- CFHTTPCookieStorageRef cookieStorage = currentCookieStorage();
- if (!cookieStorage)
- return;
-
- RetainPtr<CFURLRef> urlCF(AdoptCF, url.createCFURL());
-
- bool sendSecureCookies = url.protocolIs("https");
- RetainPtr<CFArrayRef> cookiesCF(AdoptCF, CFHTTPCookieStorageCopyCookiesForURL(cookieStorage, urlCF.get(), sendSecureCookies));
-
- 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) {
- CFHTTPCookieStorageDeleteCookie(cookieStorage, cookie);
- break;
- }
- }
-}
-
-}
diff --git a/WebCore/platform/network/win/CookieStorageWin.cpp b/WebCore/platform/network/win/CookieStorageWin.cpp
deleted file mode 100644
index 5e74c17..0000000
--- a/WebCore/platform/network/win/CookieStorageWin.cpp
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright (C) 2008 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-
-#include "CookieStorageWin.h"
-
-#include <CFNetwork/CFHTTPCookiesPriv.h>
-#include <WebKitSystemInterface/WebKitSystemInterface.h>
-#include <wtf/RetainPtr.h>
-
-namespace WebCore {
-
-static RetainPtr<CFHTTPCookieStorageRef> s_cookieStorage;
-
-CFHTTPCookieStorageRef currentCookieStorage()
-{
- if (s_cookieStorage)
- return s_cookieStorage.get();
- return wkGetDefaultHTTPCookieStorage();
-}
-
-void setCurrentCookieStorage(CFHTTPCookieStorageRef cookieStorage)
-{
- s_cookieStorage = cookieStorage;
-}
-
-}
diff --git a/WebCore/platform/network/win/CookieStorageWin.h b/WebCore/platform/network/win/CookieStorageWin.h
deleted file mode 100644
index 4350b72..0000000
--- a/WebCore/platform/network/win/CookieStorageWin.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright (C) 2008 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef CookieStorageWin_h
-#define CookieStorageWin_h
-
-typedef struct OpaqueCFHTTPCookieStorage* CFHTTPCookieStorageRef;
-
-namespace WebCore {
-
- CFHTTPCookieStorageRef currentCookieStorage();
-
- void setCurrentCookieStorage(CFHTTPCookieStorageRef cookieStorage);
-
-}
-
-#endif // CookieStorageWin_h
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list