WebKit2: Use CFNetwork Sessions API.
authorjberlin@webkit.org <jberlin@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 4 Mar 2011 23:09:26 +0000 (23:09 +0000)
committerjberlin@webkit.org <jberlin@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 4 Mar 2011 23:09:26 +0000 (23:09 +0000)
https://bugs.webkit.org/show_bug.cgi?id=55435.

Reviewed by Darin Adler.

Add in the CFURLSTORAGESESSIONS guards that I incorrectly left out because the code was
contained within guards that made USE(CFURLSTORAGESESSIONS) always be true.

Source/WebCore:

* platform/network/cf/ResourceHandleCFNet.cpp:
(WebCore::makeFinalRequest):
(WebCore::ResourceHandle::willSendRequest):
* platform/network/cf/ResourceRequestCFNet.cpp:
* platform/network/mac/ResourceHandleMac.mm:
(WebCore::ResourceHandle::createNSURLConnection):
(WebCore::ResourceHandle::willSendRequest):
* platform/network/mac/ResourceRequestMac.mm:

Source/WebKit2:

* UIProcess/mac/WebContextMac.mm:
(WebKit::WebContext::platformInitializeWebProcess):
* UIProcess/win/WebContextWin.cpp:
(WebKit::WebContext::platformInitializeWebProcess):

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

Source/WebCore/ChangeLog
Source/WebCore/platform/network/cf/ResourceHandleCFNet.cpp
Source/WebCore/platform/network/cf/ResourceRequestCFNet.cpp
Source/WebCore/platform/network/mac/ResourceHandleMac.mm
Source/WebCore/platform/network/mac/ResourceRequestMac.mm
Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/mac/WebContextMac.mm
Source/WebKit2/UIProcess/win/WebContextWin.cpp

index 96ccb4f..33bd5c3 100644 (file)
@@ -1,3 +1,22 @@
+2011-03-04  Jessie Berlin  <jberlin@apple.com>
+
+        Reviewed by Darin Adler.
+
+        WebKit2: Use CFNetwork Sessions API.
+        https://bugs.webkit.org/show_bug.cgi?id=55435.
+
+        Add in the CFURLSTORAGESESSIONS guards that I incorrectly left out because the code was
+        contained within guards that made USE(CFURLSTORAGESESSIONS) always be true.
+
+        * platform/network/cf/ResourceHandleCFNet.cpp:
+        (WebCore::makeFinalRequest):
+        (WebCore::ResourceHandle::willSendRequest):
+        * platform/network/cf/ResourceRequestCFNet.cpp:
+        * platform/network/mac/ResourceHandleMac.mm:
+        (WebCore::ResourceHandle::createNSURLConnection):
+        (WebCore::ResourceHandle::willSendRequest):
+        * platform/network/mac/ResourceRequestMac.mm:
+
 2011-03-04  Yuqiang Xian  <yuqiang.xian@intel.com>
 
         Reviewed by Darin Adler.
index e9fbb7c..f840b04 100644 (file)
@@ -335,8 +335,10 @@ static CFURLRequestRef makeFinalRequest(const ResourceRequest& request, bool sho
 {
     CFMutableURLRequestRef newRequest = CFURLRequestCreateMutableCopy(kCFAllocatorDefault, request.cfURLRequest());
 
+#if USE(CFURLSTORAGESESSIONS)
     if (CFURLStorageSessionRef storageSession = ResourceHandle::privateBrowsingStorageSession())
         wkSetRequestStorageSession(storageSession, newRequest);
+#endif
     
     if (!shouldContentSniff)
         wkSetCFURLRequestShouldContentSniff(newRequest, false);
@@ -484,8 +486,10 @@ void ResourceHandle::willSendRequest(ResourceRequest& request, const ResourceRes
     if (!protocolHostAndPortAreEqual(request.url(), redirectResponse.url()))
         request.clearHTTPAuthorization();
 
+#if USE(CFURLSTORAGESESSIONS)
     if (CFURLStorageSessionRef storageSession = privateBrowsingStorageSession())
         request.setStorageSession(storageSession);
+#endif
 
     client()->willSendRequest(this, request, redirectResponse);
 }
@@ -722,6 +726,8 @@ bool ResourceHandle::willLoadFromCache(ResourceRequest& request, Frame* frame)
     return cached;
 }
 
+#if USE(CFURLSTORAGESESSIONS)
+
 RetainPtr<CFURLStorageSessionRef> ResourceHandle::createPrivateBrowsingStorageSession(CFStringRef identifier)
 {
     return RetainPtr<CFURLStorageSessionRef>(AdoptCF, wkCreatePrivateStorageSession(identifier));
@@ -732,6 +738,8 @@ String ResourceHandle::privateBrowsingStorageSessionIdentifierDefaultBase()
     return String(reinterpret_cast<CFStringRef>(CFBundleGetValueForInfoDictionaryKey(CFBundleGetMainBundle(), kCFBundleIdentifierKey)));
 }
 
+#endif
+
 void WebCoreSynchronousLoaderClient::willSendRequest(ResourceHandle* handle, ResourceRequest& request, const ResourceResponse& /*redirectResponse*/)
 {
     // FIXME: This needs to be fixed to follow the redirect correctly even for cross-domain requests.
index 6314866..fdccc11 100644 (file)
@@ -195,6 +195,8 @@ void ResourceRequest::doUpdateResourceRequest()
     m_httpBody = httpBodyFromRequest(m_cfRequest.get());
 }
 
+#if USE(CFURLSTORAGESESSIONS)
+
 void ResourceRequest::setStorageSession(CFURLStorageSessionRef storageSession)
 {
     CFMutableURLRequestRef cfRequest = CFURLRequestCreateMutableCopy(0, m_cfRequest.get());
@@ -202,6 +204,8 @@ void ResourceRequest::setStorageSession(CFURLStorageSessionRef storageSession)
     m_cfRequest.adoptCF(cfRequest);
 }
 
+#endif
+
 #endif // USE(CFNETWORK)
 
 unsigned initializeMaximumHTTPConnectionCountPerHost()
index 628181e..ae90e06 100644 (file)
@@ -239,8 +239,10 @@ void ResourceHandle::createNSURLConnection(id delegate, bool shouldUseCredential
     static bool supportsSettingConnectionProperties = [NSURLConnection instancesRespondToSelector:@selector(_initWithRequest:delegate:usesCache:maxContentLength:startImmediately:connectionProperties:)];
 #endif
 
+#if USE(CFURLSTORAGESESSIONS)
     if (CFURLStorageSessionRef storageSession = privateBrowsingStorageSession())
         nsRequest = [wkCopyRequestWithStorageSession(storageSession, nsRequest) autorelease];
+#endif
 
     if (supportsSettingConnectionProperties) {
         NSDictionary *sessionID = shouldUseCredentialStorage ? [NSDictionary dictionary] : [NSDictionary dictionaryWithObject:@"WebKitPrivateSession" forKey:@"_kCFURLConnectionSessionID"];
@@ -555,8 +557,10 @@ void ResourceHandle::willSendRequest(ResourceRequest& request, const ResourceRes
     if (!protocolHostAndPortAreEqual(request.url(), redirectResponse.url()))
         request.clearHTTPAuthorization();
 
+#if USE(CFURLSTORAGESESSIONS)
     if (CFURLStorageSessionRef storageSession = privateBrowsingStorageSession())
         request.setStorageSession(storageSession);
+#endif
 
     client()->willSendRequest(this, request, redirectResponse);
 }
@@ -699,6 +703,8 @@ void ResourceHandle::receivedCancellation(const AuthenticationChallenge& challen
         client()->receivedCancellation(this, challenge);
 }
 
+#if USE(CFURLSTORAGESESSIONS)
+
 RetainPtr<CFURLStorageSessionRef> ResourceHandle::createPrivateBrowsingStorageSession(CFStringRef identifier)
 {
     return RetainPtr<CFURLStorageSessionRef>(AdoptCF, wkCreatePrivateStorageSession(identifier));
@@ -709,6 +715,8 @@ String ResourceHandle::privateBrowsingStorageSessionIdentifierDefaultBase()
     return String([[NSBundle mainBundle] bundleIdentifier]);
 }
 
+#endif
+
 } // namespace WebCore
 
 @implementation WebCoreResourceHandleAsDelegate
index 6398e9e..8446782 100644 (file)
@@ -174,11 +174,15 @@ void ResourceRequest::applyWebArchiveHackForMail()
     [NSURLProtocol setProperty:@"" forKey:@"WebDataRequest" inRequest:(NSMutableURLRequest *)nsURLRequest()];
 }
 
+#if USE(CFURLSTORAGESESSIONS)
+
 void ResourceRequest::setStorageSession(CFURLStorageSessionRef storageSession)
 {
     m_nsRequest = wkCopyRequestWithStorageSession(storageSession, m_nsRequest.get());
 }
 
+#endif
+
 } // namespace WebCore
 
 #endif // !USE(CFNETWORK)
index d24365f..52ab11c 100644 (file)
@@ -1,5 +1,20 @@
 2011-03-04  Jessie Berlin  <jberlin@apple.com>
 
+        Reviewed by Darin Adler.
+
+        WebKit2: Use CFNetwork Sessions API.
+        https://bugs.webkit.org/show_bug.cgi?id=55435.
+
+        Add in the CFURLSTORAGESESSIONS guards that I incorrectly left out because the code was
+        contained within guards that made USE(CFURLSTORAGESESSIONS) always be true.
+
+        * UIProcess/mac/WebContextMac.mm:
+        (WebKit::WebContext::platformInitializeWebProcess):
+        * UIProcess/win/WebContextWin.cpp:
+        (WebKit::WebContext::platformInitializeWebProcess):
+
+2011-03-04  Jessie Berlin  <jberlin@apple.com>
+
         Reviewed by Maciej Stachowiak.
 
         WebKit2: Use CFNetwork Sessions API.
index 292d0fa..498b6e7 100644 (file)
@@ -94,7 +94,9 @@ void WebContext::platformInitializeWebProcess(WebProcessCreationParameters& para
     // FIXME: This should really be configurable; we shouldn't just blindly allow read access to the UI process bundle.
     parameters.uiProcessBundleResourcePath = fileSystemRepresentation([[NSBundle mainBundle] resourcePath]);
 
+#if USE(CFURLSTORAGESESSIONS)
     parameters.uiProcessBundleIdentifier = String([[NSBundle mainBundle] bundleIdentifier]);
+#endif
 }
 
 String WebContext::platformDefaultDatabaseDirectory() const
index a0fdc06..26708d7 100644 (file)
@@ -69,8 +69,11 @@ void WebContext::platformInitializeWebProcess(WebProcessCreationParameters& para
     if (parameters.cfURLCachePath[parameters.cfURLCachePath.length() - 1] == '/')
         parameters.cfURLCachePath.remove(parameters.cfURLCachePath.length() - 1);
 
+#if USE(CFURLSTORAGESESSIONS)
     parameters.uiProcessBundleIdentifier = String(reinterpret_cast<CFStringRef>(CFBundleGetValueForInfoDictionaryKey(CFBundleGetMainBundle(), kCFBundleIdentifierKey)));
-#endif
+#endif // USE(CFURLSTORAGESESSIONS)
+
+#endif // USE(CFNETWORK)
 }
 
 String WebContext::platformDefaultDatabaseDirectory() const