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 0335f239d49a8707df7f93d643cc5251e8f62502..0fdd9fc78cb56f476155b59c49bb248b1fefd6f1 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 44f8457dbf9c0fc09db5bd1c999346897732dd96..e69cd04ceca0b8eea79c5523e470b5ac44bd82d4 100644 (file)
@@ -1336,6 +1336,7 @@ _wkSignalCFReadStreamEnd
 _wkSignalCFReadStreamError
 _wkSignalCFReadStreamHasBytes
 _wkCreatePrivateStorageSession
+_wkCopyRequestWithStorageSession
 
 #if !defined(NDEBUG)
 __ZN7WebCore20LogNotYetImplementedE
index e51e15d3c295b1e27f200ca90cc0bae52e69ae2c..a175f5e50e7739ddade615a8e9ad1605d298b015 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 ce8fa5ed02ea5e4a1af8abf792b1dffb23f39dcf..beba334471bd0e1629ccb2a0c451794a409d4989 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 76190133229d0fc7bd4060b6756949fe8446d8ef..e9fbb7c43b72be7e4ccaa9f0d9f100225ef746b1 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 172ebe1d28f359ff12ad23d64836607b4aff2128..2da5026edb7b303908f68309d261c6946f8039ab 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 7a1dfd56dd7a3f8c71f601b14f8aa4727e85aa51..6314866fab05f5fbe914297ce0aa0f76a7588a2c 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 42d36af9d3335fd34113ce0cb38eed535118c244..628181e23785d923c8e2683bcd8f321ff2770175 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 099fe93c9de595cfb75715b529af864943375992..6398e9ed9aca89dd9ea45d0101741e22be72b3f7 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 f1bffdf74b25f5b4f57e8f8c1e07b6b9d5ae1cc4..2d9b394d7bfad7b3fa8560fa3e824ac99a329cc8 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 776080c786252a6b196d69953f4270e77bf9ed0e..ff1073d14993db2cb0663b87db007c8e88183f32 100644 (file)
@@ -167,6 +167,7 @@ void InitWebCoreSystemInterface(void)
     INIT(CreateAXUIElementRef);
     INIT(UnregisterUniqueIdForElement);
     INIT(CreatePrivateStorageSession);
+    INIT(CopyRequestWithStorageSession);
 
     didInit = true;
 }
index 0a1045f5b7b72c1ebc7018de0f5449713346d975..1e944463f26197c230b5d156d43551e250f4cf48 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 3483b68750e95b960a520d4e15805cfa6a14b116..36f72ba6a1c72e503f330a6dd45506b7ca69d925 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 f8d313b50d4d279795bb59c1bea4ffbca532d960..a3d65e9fe08e1766a6aa6b1068c3823c6c559dcf 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 bdb0dd64a878b3cd7225cac5b843936c4749dde9..efa78955c04aa1f4176ff9bf4146f55ba4aa35b5 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 27d9bf2410ad9640c9abf4e6aea72b6323e7d3d3..ba01d8a6b5be11f1bbe5803413ccaa6d8cef1389 100644 (file)
Binary files a/WebKitLibraries/libWebKitSystemInterfaceLeopard.a and b/WebKitLibraries/libWebKitSystemInterfaceLeopard.a differ
index 1f12671e272867731a35e98bf8b721275efbb49f..3f9bf210f91ac71a76f4129019af19d7e4b3af01 100644 (file)
Binary files a/WebKitLibraries/libWebKitSystemInterfaceSnowLeopard.a and b/WebKitLibraries/libWebKitSystemInterfaceSnowLeopard.a differ
index 77a061dc61e0bf474e4122e7bee816e38dce5840..575ef5c6d144625ded2bf740b772f45352e20649 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 6ad4f229cde1900e5c909d6a0bdb5c206b7e608c..5ab1d7c3874044f3962a21d2f4aeff838b240c24 100644 (file)
Binary files a/WebKitLibraries/win/lib/WebKitSystemInterface.lib and b/WebKitLibraries/win/lib/WebKitSystemInterface.lib differ