Source/WebCore: WebKit2: Use CFNetwork Sessions API.
authorjberlin@webkit.org <jberlin@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 3 Mar 2011 23:43:07 +0000 (23:43 +0000)
committerjberlin@webkit.org <jberlin@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 3 Mar 2011 23:43:07 +0000 (23:43 +0000)
https://bugs.webkit.org/show_bug.cgi?id=55435

Reviewed by Adam Roben.

Set the Private Browsing Storage Session on requests when Private Browsing is enabled.

* WebCore.exp.in:
Support using WKCopyRequestWithStorageSession in WebCore.
* platform/mac/WebCoreSystemInterface.h:
Ditto.
* platform/mac/WebCoreSystemInterface.mm:
Ditto.

* platform/network/cf/ResourceHandleCFNet.cpp:
(WebCore::makeFinalRequest):
If Private Browsing is enabled, set the Private Browsing Storage Session on the request.
(WebCore::ResourceHandle::willSendRequest):
Ditto.
* platform/network/mac/ResourceHandleMac.mm:
(WebCore::ResourceHandle::createNSURLConnection):
Ditto.
(WebCore::ResourceHandle::willSendRequest):
Ditto.

* platform/network/cf/ResourceRequest.h:
* platform/network/cf/ResourceRequestCFNet.cpp:
(WebCore::ResourceRequest::setStorageSession):
Call through to WKSI.
* platform/network/mac/ResourceRequestMac.mm:
(WebCore::ResourceRequest::setStorageSession):
Ditto.

Source/WebKit/mac: WebKit2: Use CFNetwork Sessions API.
https://bugs.webkit.org/show_bug.cgi?id=55435.

Reviewed by Adam Roben.

Set the Private Browsing Storage Session on requests when Private Browsing is enabled.

* WebCoreSupport/WebSystemInterface.mm:
(InitWebCoreSystemInterface):
Support using WKCopyRequestWithStorageSession in WebCore.

Source/WebKit2: WebKit2: Use CFNetwork Sessions API.
https://bugs.webkit.org/show_bug.cgi?id=55435

Reviewed by Adam Roben.

Set the Private Browsing Storage Session on requests when Private Browsing is enabled.

* WebProcess/WebCoreSupport/mac/WebSystemInterface.mm:
(InitWebCoreSystemInterface):
Support using WKCopyRequestWithStorageSession in WebCore.

WebKitLibraries: WebKit2: Use CFNetwork Sessions API.
https://bugs.webkit.org/show_bug.cgi?id=55435

Reviewed by Adam Roben.

Set the Private Browsing Storage Session on requests when Private Browsing is enabled.

Update WebKitSystemInterface headers and libraries with the new functions.

* WebKitSystemInterface.h:
* libWebKitSystemInterfaceLeopard.a:
* libWebKitSystemInterfaceSnowLeopard.a:
* win/include/WebKitSystemInterface/WebKitSystemInterface.h:
* win/lib/WebKitSystemInterface.lib:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@80294 268f45cc-cd09-0410-ab3c-d52691b4dbfc

19 files changed:
Source/WebCore/ChangeLog
Source/WebCore/WebCore.exp.in
Source/WebCore/platform/mac/WebCoreSystemInterface.h
Source/WebCore/platform/mac/WebCoreSystemInterface.mm
Source/WebCore/platform/network/cf/ResourceHandleCFNet.cpp
Source/WebCore/platform/network/cf/ResourceRequest.h
Source/WebCore/platform/network/cf/ResourceRequestCFNet.cpp
Source/WebCore/platform/network/mac/ResourceHandleMac.mm
Source/WebCore/platform/network/mac/ResourceRequestMac.mm
Source/WebKit/mac/ChangeLog
Source/WebKit/mac/WebCoreSupport/WebSystemInterface.mm
Source/WebKit2/ChangeLog
Source/WebKit2/WebProcess/WebCoreSupport/mac/WebSystemInterface.mm
WebKitLibraries/ChangeLog
WebKitLibraries/WebKitSystemInterface.h
WebKitLibraries/libWebKitSystemInterfaceLeopard.a
WebKitLibraries/libWebKitSystemInterfaceSnowLeopard.a
WebKitLibraries/win/include/WebKitSystemInterface/WebKitSystemInterface.h
WebKitLibraries/win/lib/WebKitSystemInterface.lib

index 0335f23..0fdd9fc 100644 (file)
@@ -1,3 +1,38 @@
+2011-03-03  Jessie Berlin  <jberlin@apple.com>
+
+        Reviewed by Adam Roben.
+
+        WebKit2: Use CFNetwork Sessions API.
+        https://bugs.webkit.org/show_bug.cgi?id=55435
+
+        Set the Private Browsing Storage Session on requests when Private Browsing is enabled.
+
+        * WebCore.exp.in:
+        Support using WKCopyRequestWithStorageSession in WebCore.
+        * platform/mac/WebCoreSystemInterface.h:
+        Ditto.
+        * platform/mac/WebCoreSystemInterface.mm:
+        Ditto.
+
+        * platform/network/cf/ResourceHandleCFNet.cpp:
+        (WebCore::makeFinalRequest):
+        If Private Browsing is enabled, set the Private Browsing Storage Session on the request.
+        (WebCore::ResourceHandle::willSendRequest):
+        Ditto.
+        * platform/network/mac/ResourceHandleMac.mm:
+        (WebCore::ResourceHandle::createNSURLConnection):
+        Ditto.
+        (WebCore::ResourceHandle::willSendRequest):
+        Ditto.
+
+        * platform/network/cf/ResourceRequest.h:
+        * platform/network/cf/ResourceRequestCFNet.cpp:
+        (WebCore::ResourceRequest::setStorageSession):
+        Call through to WKSI.
+        * platform/network/mac/ResourceRequestMac.mm:
+        (WebCore::ResourceRequest::setStorageSession):
+        Ditto.
+
 2011-03-03  Chris Marrin  <cmarrin@apple.com>
 
         Reviewed by Simon Fraser.
index 44f8457..e69cd04 100644 (file)
@@ -1336,6 +1336,7 @@ _wkSignalCFReadStreamEnd
 _wkSignalCFReadStreamError
 _wkSignalCFReadStreamHasBytes
 _wkCreatePrivateStorageSession
+_wkCopyRequestWithStorageSession
 
 #if !defined(NDEBUG)
 __ZN7WebCore20LogNotYetImplementedE
index e51e15d..a175f5e 100644 (file)
@@ -237,6 +237,7 @@ extern AXUIElementRef (*wkCreateAXUIElementRef)(id element);
 
 typedef const struct __CFURLStorageSession* CFURLStorageSessionRef;
 extern CFURLStorageSessionRef (*wkCreatePrivateStorageSession)(CFStringRef);
+extern NSURLRequest* (*wkCopyRequestWithStorageSession)(CFURLStorageSessionRef, NSURLRequest*);
 
 }
 
index ce8fa5e..beba334 100644 (file)
@@ -173,4 +173,4 @@ BOOL (*wkGetBytesFromAXTextMarker)(CFTypeRef textMarker, void *bytes, size_t len
 AXUIElementRef (*wkCreateAXUIElementRef)(id element);
 
 CFURLStorageSessionRef (*wkCreatePrivateStorageSession)(CFStringRef);
-
+NSURLRequest* (*wkCopyRequestWithStorageSession)(CFURLStorageSessionRef, NSURLRequest*);
index 7619013..e9fbb7c 100644 (file)
@@ -334,6 +334,9 @@ CFArrayRef arrayFromFormData(const FormData& d)
 static CFURLRequestRef makeFinalRequest(const ResourceRequest& request, bool shouldContentSniff)
 {
     CFMutableURLRequestRef newRequest = CFURLRequestCreateMutableCopy(kCFAllocatorDefault, request.cfURLRequest());
+
+    if (CFURLStorageSessionRef storageSession = ResourceHandle::privateBrowsingStorageSession())
+        wkSetRequestStorageSession(storageSession, newRequest);
     
     if (!shouldContentSniff)
         wkSetCFURLRequestShouldContentSniff(newRequest, false);
@@ -481,6 +484,9 @@ void ResourceHandle::willSendRequest(ResourceRequest& request, const ResourceRes
     if (!protocolHostAndPortAreEqual(request.url(), redirectResponse.url()))
         request.clearHTTPAuthorization();
 
+    if (CFURLStorageSessionRef storageSession = privateBrowsingStorageSession())
+        request.setStorageSession(storageSession);
+
     client()->willSendRequest(this, request, redirectResponse);
 }
 
index 172ebe1..2da5026 100644 (file)
@@ -40,6 +40,10 @@ class NSURLRequest;
 #endif
 #endif
 
+#if USE(CFURLSTORAGESESSIONS)
+typedef const struct __CFURLStorageSession* CFURLStorageSessionRef;
+#endif
+
 namespace WebCore {
 
     class ResourceRequest : public ResourceRequestBase {
@@ -80,6 +84,10 @@ namespace WebCore {
         NSURLRequest* nsURLRequest() const;
 #endif
 
+#if USE(CFURLSTORAGESESSIONS)
+        void setStorageSession(CFURLStorageSessionRef);
+#endif
+
     private:
         friend class ResourceRequestBase;
 
index 7a1dfd5..6314866 100644 (file)
@@ -195,6 +195,13 @@ void ResourceRequest::doUpdateResourceRequest()
     m_httpBody = httpBodyFromRequest(m_cfRequest.get());
 }
 
+void ResourceRequest::setStorageSession(CFURLStorageSessionRef storageSession)
+{
+    CFMutableURLRequestRef cfRequest = CFURLRequestCreateMutableCopy(0, m_cfRequest.get());
+    wkSetRequestStorageSession(storageSession, cfRequest);
+    m_cfRequest.adoptCF(cfRequest);
+}
+
 #endif // USE(CFNETWORK)
 
 unsigned initializeMaximumHTTPConnectionCountPerHost()
index 42d36af..628181e 100644 (file)
@@ -239,6 +239,9 @@ void ResourceHandle::createNSURLConnection(id delegate, bool shouldUseCredential
     static bool supportsSettingConnectionProperties = [NSURLConnection instancesRespondToSelector:@selector(_initWithRequest:delegate:usesCache:maxContentLength:startImmediately:connectionProperties:)];
 #endif
 
+    if (CFURLStorageSessionRef storageSession = privateBrowsingStorageSession())
+        nsRequest = [wkCopyRequestWithStorageSession(storageSession, nsRequest) autorelease];
+
     if (supportsSettingConnectionProperties) {
         NSDictionary *sessionID = shouldUseCredentialStorage ? [NSDictionary dictionary] : [NSDictionary dictionaryWithObject:@"WebKitPrivateSession" forKey:@"_kCFURLConnectionSessionID"];
         NSDictionary *propertyDictionary = [NSDictionary dictionaryWithObject:sessionID forKey:@"kCFURLConnectionSocketStreamProperties"];
@@ -552,6 +555,9 @@ void ResourceHandle::willSendRequest(ResourceRequest& request, const ResourceRes
     if (!protocolHostAndPortAreEqual(request.url(), redirectResponse.url()))
         request.clearHTTPAuthorization();
 
+    if (CFURLStorageSessionRef storageSession = privateBrowsingStorageSession())
+        request.setStorageSession(storageSession);
+
     client()->willSendRequest(this, request, redirectResponse);
 }
 
index 099fe93..6398e9e 100644 (file)
@@ -174,6 +174,11 @@ void ResourceRequest::applyWebArchiveHackForMail()
     [NSURLProtocol setProperty:@"" forKey:@"WebDataRequest" inRequest:(NSMutableURLRequest *)nsURLRequest()];
 }
 
+void ResourceRequest::setStorageSession(CFURLStorageSessionRef storageSession)
+{
+    m_nsRequest = wkCopyRequestWithStorageSession(storageSession, m_nsRequest.get());
+}
+
 } // namespace WebCore
 
 #endif // !USE(CFNETWORK)
index f1bffdf..2d9b394 100644 (file)
@@ -1,3 +1,16 @@
+2011-03-03  Jessie Berlin  <jberlin@apple.com>
+
+        Reviewed by Adam Roben.
+
+        WebKit2: Use CFNetwork Sessions API.
+        https://bugs.webkit.org/show_bug.cgi?id=55435.
+
+        Set the Private Browsing Storage Session on requests when Private Browsing is enabled.
+
+        * WebCoreSupport/WebSystemInterface.mm:
+        (InitWebCoreSystemInterface):
+        Support using WKCopyRequestWithStorageSession in WebCore.
+
 2011-03-02  Alexey Proskuryakov  <ap@apple.com>
 
         Reviewed by Darin Adler.
index 776080c..ff1073d 100644 (file)
@@ -167,6 +167,7 @@ void InitWebCoreSystemInterface(void)
     INIT(CreateAXUIElementRef);
     INIT(UnregisterUniqueIdForElement);
     INIT(CreatePrivateStorageSession);
+    INIT(CopyRequestWithStorageSession);
 
     didInit = true;
 }
index 0a1045f..1e94446 100644 (file)
@@ -1,3 +1,16 @@
+2011-03-03  Jessie Berlin  <jberlin@apple.com>
+
+        Reviewed by Adam Roben.
+
+        WebKit2: Use CFNetwork Sessions API.
+        https://bugs.webkit.org/show_bug.cgi?id=55435
+
+        Set the Private Browsing Storage Session on requests when Private Browsing is enabled.
+
+        * WebProcess/WebCoreSupport/mac/WebSystemInterface.mm:
+        (InitWebCoreSystemInterface):
+        Support using WKCopyRequestWithStorageSession in WebCore.
+
 2011-03-03  Adam Roben  <aroben@apple.com>
 
         Don't try to paint outside the page's bounds
index 3483b68..36f72ba 100644 (file)
@@ -94,6 +94,7 @@ void InitWebCoreSystemInterface(void)
         INIT(SignalCFReadStreamError);
         INIT(SignalCFReadStreamHasBytes);
         INIT(CreatePrivateStorageSession);
+        INIT(CopyRequestWithStorageSession);
 
 #if !defined(BUILDING_ON_SNOW_LEOPARD)
         INIT(IOSurfaceContextCreate);
index f8d313b..a3d65e9 100644 (file)
@@ -1,3 +1,20 @@
+2011-03-03  Jessie Berlin  <jberlin@apple.com>
+
+        Reviewed by Adam Roben.
+
+        WebKit2: Use CFNetwork Sessions API.
+        https://bugs.webkit.org/show_bug.cgi?id=55435
+
+        Set the Private Browsing Storage Session on requests when Private Browsing is enabled.
+
+        Update WebKitSystemInterface headers and libraries with the new functions.
+
+        * WebKitSystemInterface.h:
+        * libWebKitSystemInterfaceLeopard.a:
+        * libWebKitSystemInterfaceSnowLeopard.a:
+        * win/include/WebKitSystemInterface/WebKitSystemInterface.h:
+        * win/lib/WebKitSystemInterface.lib:
+
 2011-03-02  Jessie Berlin  <jberlin@apple.com>
 
         Update WebKitSystemInterface libraries. Library changes reviewed by Darin Adler.
index bdb0dd6..efa7895 100644 (file)
@@ -235,6 +235,7 @@ CFStringRef WKCopyFoundationCacheDirectory(void);
 
 typedef const struct __CFURLStorageSession* CFURLStorageSessionRef;
 CFURLStorageSessionRef WKCreatePrivateStorageSession(CFStringRef);
+NSURLRequest *WKCopyRequestWithStorageSession(CFURLStorageSessionRef, NSURLRequest*);
 
 void WKSetVisibleApplicationName(CFStringRef);
 
index 27d9bf2..ba01d8a 100644 (file)
Binary files a/WebKitLibraries/libWebKitSystemInterfaceLeopard.a and b/WebKitLibraries/libWebKitSystemInterfaceLeopard.a differ
index 1f12671..3f9bf21 100644 (file)
Binary files a/WebKitLibraries/libWebKitSystemInterfaceSnowLeopard.a and b/WebKitLibraries/libWebKitSystemInterfaceSnowLeopard.a differ
index 77a061d..575ef5c 100644 (file)
@@ -97,6 +97,7 @@ CFArrayRef wkCFURLRequestCopyHTTPRequestBodyParts(CFURLRequestRef);
 void wkCFURLRequestSetHTTPRequestBodyParts(CFMutableURLRequestRef, CFArrayRef bodyParts);
 
 CFURLStorageSessionRef wkCreatePrivateStorageSession(CFStringRef identifier);
+void wkSetRequestStorageSession(CFURLStorageSessionRef, CFMutableURLRequestRef);
 
 CFArrayRef wkCFURLCacheCopyAllHostNamesInPersistentStore();
 void wkCFURLCacheDeleteHostNamesInPersistentStore(CFArrayRef hostNames);
index 6ad4f22..5ab1d7c 100644 (file)
Binary files a/WebKitLibraries/win/lib/WebKitSystemInterface.lib and b/WebKitLibraries/win/lib/WebKitSystemInterface.lib differ