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

Reviewed by Maciej Stachowiak.

When Private Browsing is enabled, get the cached url response from the cache associated with
the Private Browsing Storage Session.

Source/WebCore:

* WebCore.exp.in:
Export the symbol for ResourceHandle::privateBrowsingStorageSession.

Source/WebKit/mac:

* WebView/WebView.mm:
(-[WebView _cachedResponseForURL:]):

Source/WebKit2:

* WebProcess/WebPage/mac/WebPageMac.mm:
(WebKit::WebPage::platformHasLocalDataForURL):
If Private Browsing is enabled, call into WKSI to get the response.
(WebKit::WebPage::cachedResponseMIMETypeForURL):
Ditto.
* WebProcess/WebPage/win/WebPageWin.cpp:
(WebKit::WebPage::platformHasLocalDataForURL):
If Private Browsing is enabled, call into WKSI to get the CFURLCacheRef.
(WebKit::WebPage::cachedResponseMIMETypeForURL):
Ditto.

WebKitLibraries:

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@80370 268f45cc-cd09-0410-ab3c-d52691b4dbfc

13 files changed:
Source/WebCore/ChangeLog
Source/WebCore/WebCore.exp.in
Source/WebKit/mac/ChangeLog
Source/WebKit/mac/WebView/WebView.mm
Source/WebKit2/ChangeLog
Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm
Source/WebKit2/WebProcess/WebPage/win/WebPageWin.cpp
WebKitLibraries/ChangeLog
WebKitLibraries/WebKitSystemInterface.h
WebKitLibraries/libWebKitSystemInterfaceLeopard.a
WebKitLibraries/libWebKitSystemInterfaceSnowLeopard.a
WebKitLibraries/win/include/WebKitSystemInterface/WebKitSystemInterface.h
WebKitLibraries/win/lib/WebKitSystemInterface.lib

index ba4289a5e37cd914814b5c6a07f14f2260791359..785c7efe54b5ef937995fa77b93d98ac7b385d54 100644 (file)
@@ -1,3 +1,16 @@
+2011-03-04  Jessie Berlin  <jberlin@apple.com>
+
+        Reviewed by Maciej Stachowiak.
+
+        WebKit2: Use CFNetwork Sessions API.
+        https://bugs.webkit.org/show_bug.cgi?id=55435.
+
+        When Private Browsing is enabled, get the cached url response from the cache associated with
+        the Private Browsing Storage Session.
+
+        * WebCore.exp.in:
+        Export the symbol for ResourceHandle::privateBrowsingStorageSession.
+
 2011-03-04  Steve Block  <steveblock@google.com>
 
         Reviewed by Jeremy Orlow.
index 638c5029c981112cf4d087973a43f7fad724e3e8..27cc1e58f90247abcb917254fd8c4034a271e704 100644 (file)
@@ -1790,4 +1790,5 @@ __ZN7WebCore12EventHandler18handleGestureEventERKNS_20PlatformGestureEventE
 
 #if USE(CFURLSTORAGESESSIONS)
 __ZN7WebCore14ResourceHandle46setPrivateBrowsingStorageSessionIdentifierBaseERKN3WTF6StringE
+__ZN7WebCore14ResourceHandle29privateBrowsingStorageSessionEv
 #endif
index 7fea19e62318f12b4875bc07e19af40d0d116916..17dc4d4009eb1339185febc9bbf5a0590540af1a 100644 (file)
@@ -1,3 +1,16 @@
+2011-03-04  Jessie Berlin  <jberlin@apple.com>
+
+        Reviewed by Maciej Stachowiak.
+
+        WebKit2: Use CFNetwork Sessions API.
+        https://bugs.webkit.org/show_bug.cgi?id=55435.
+
+        When Private Browsing is enabled, get the cached url response from the cache associated with
+        the Private Browsing Storage Session.
+
+        * WebView/WebView.mm:
+        (-[WebView _cachedResponseForURL:]):
+
 2011-03-03  Anders Carlsson  <andersca@apple.com>
 
         Reviewed by Sam Weinig.
index 81dbc61e0a507798b501cab998e79dcc04da795d..2f45ca41050ae4a36c3294bfd33da3f61bf92331 100644 (file)
@@ -1871,7 +1871,13 @@ static inline IMP getMethod(id o, SEL s)
 {
     NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:URL];
     [request _web_setHTTPUserAgent:[self userAgentForURL:URL]];
-    NSCachedURLResponse *cachedResponse = [[NSURLCache sharedURLCache] cachedResponseForRequest:request];
+    NSCachedURLResponse *cachedResponse;
+#if USE(CFURLSTORAGESESSIONS)
+    if (CFURLStorageSessionRef storageSession = ResourceHandle::privateBrowsingStorageSession())
+        cachedResponse = WKCachedResponseForRequest(storageSession, request);
+    else
+#endif
+        cachedResponse = [[NSURLCache sharedURLCache] cachedResponseForRequest:request];
     [request release];
     return cachedResponse;
 }
index 2eb26df5a88f846eb5a42597be0284c0fcf5707d..d24365fa3acc0174b542775c818d6fc4b95ee7e6 100644 (file)
@@ -1,3 +1,24 @@
+2011-03-04  Jessie Berlin  <jberlin@apple.com>
+
+        Reviewed by Maciej Stachowiak.
+
+        WebKit2: Use CFNetwork Sessions API.
+        https://bugs.webkit.org/show_bug.cgi?id=55435.
+
+        When Private Browsing is enabled, get the cached url response from the cache associated with
+        the Private Browsing Storage Session.
+
+        * WebProcess/WebPage/mac/WebPageMac.mm:
+        (WebKit::WebPage::platformHasLocalDataForURL):
+        If Private Browsing is enabled, call into WKSI to get the response.
+        (WebKit::WebPage::cachedResponseMIMETypeForURL):
+        Ditto.
+        * WebProcess/WebPage/win/WebPageWin.cpp:
+        (WebKit::WebPage::platformHasLocalDataForURL):
+        If Private Browsing is enabled, call into WKSI to get the CFURLCacheRef.
+        (WebKit::WebPage::cachedResponseMIMETypeForURL):
+        Ditto.
+
 2011-03-04  Jeff Miller  <jeffm@apple.com>
 
         Reviewed by Darin Adler.
index 423e3a2b1b2f9c0a9eaa076163cb8daecd82284a..4cae5aa175f6a4dbaae4220446e8805ed73b15df 100644 (file)
@@ -42,6 +42,7 @@
 #import <WebCore/KeyboardEvent.h>
 #import <WebCore/Page.h>
 #import <WebCore/PlatformKeyboardEvent.h>
+#import <WebCore/ResourceHandle.h>
 #import <WebCore/ScrollView.h>
 #import <WebCore/TextIterator.h>
 #import <WebCore/WindowsKeyboardCodes.h>
@@ -443,7 +444,13 @@ bool WebPage::platformHasLocalDataForURL(const WebCore::KURL& url)
 {
     NSMutableURLRequest* request = [[NSMutableURLRequest alloc] initWithURL:url];
     [request setValue:(NSString*)userAgent() forHTTPHeaderField:@"User-Agent"];
-    NSCachedURLResponse *cachedResponse = [[NSURLCache sharedURLCache] cachedResponseForRequest:request];
+    NSCachedURLResponse *cachedResponse;
+#if USE(CFURLSTORAGESESSIONS)
+    if (CFURLStorageSessionRef storageSession = ResourceHandle::privateBrowsingStorageSession())
+        cachedResponse = WKCachedResponseForRequest(storageSession, request);
+    else
+#endif
+        cachedResponse = [[NSURLCache sharedURLCache] cachedResponseForRequest:request];
     [request release];
     
     return cachedResponse;
@@ -453,7 +460,13 @@ String WebPage::cachedResponseMIMETypeForURL(const WebCore::KURL& url)
 {
     NSMutableURLRequest* request = [[NSMutableURLRequest alloc] initWithURL:url];
     [request setValue:(NSString*)userAgent() forHTTPHeaderField:@"User-Agent"];
-    NSCachedURLResponse *cachedResponse = [[NSURLCache sharedURLCache] cachedResponseForRequest:request];
+    NSCachedURLResponse *cachedResponse;
+#if USE(CFURLSTORAGESESSIONS)
+    if (CFURLStorageSessionRef storageSession = ResourceHandle::privateBrowsingStorageSession())
+        cachedResponse = WKCachedResponseForRequest(storageSession, request);
+    else
+#endif
+        cachedResponse = [[NSURLCache sharedURLCache] cachedResponseForRequest:request];
     [request release];
     
     return [[cachedResponse response] MIMEType];
index e20af3a8e5e2f75129fd937b1b022f8427334baf..73ba2b2b478be09d5d9afbd7cee1711db74b2fa1 100644 (file)
@@ -36,6 +36,7 @@
 #include <WebCore/KeyboardEvent.h>
 #include <WebCore/Page.h>
 #include <WebCore/PlatformKeyboardEvent.h>
+#include <WebCore/ResourceHandle.h>
 #include <WebCore/Settings.h>
 #if PLATFORM(CG)
 #include <WebKitSystemInterface/WebKitSystemInterface.h>
@@ -253,7 +254,13 @@ bool WebPage::platformHasLocalDataForURL(const WebCore::KURL& url)
     RetainPtr<CFStringRef> userAgent(AdoptCF, userAgent().createCFString());
     CFURLRequestSetHTTPHeaderFieldValue(request.get(), CFSTR("User-Agent"), userAgent.get());
 
-    RetainPtr<CFURLCacheRef> cache(AdoptCF, CFURLCacheCopySharedURLCache());
+    RetainPtr<CFURLCacheRef> cache;
+#if USE(CFURLSTORAGESESSIONS)
+    if (CFURLStorageSessionRef storageSession = ResourceHandle::privateBrowsingStorageSession())
+        cache.adoptCF(wkCopyURLCache(storageSession));
+    else
+#endif
+        cache.adoptCF(CFURLCacheCopySharedURLCache());
 
     RetainPtr<CFCachedURLResponseRef> response(AdoptCF, CFURLCacheCopyResponseForRequest(cache.get(), request.get()));    
     return response;
@@ -271,7 +278,13 @@ String WebPage::cachedResponseMIMETypeForURL(const WebCore::KURL& url)
     RetainPtr<CFStringRef> userAgent(AdoptCF, userAgent().createCFString());
     CFURLRequestSetHTTPHeaderFieldValue(request.get(), CFSTR("User-Agent"), userAgent.get());
 
-    RetainPtr<CFURLCacheRef> cache(AdoptCF, CFURLCacheCopySharedURLCache());
+    RetainPtr<CFURLCacheRef> cache;
+#if USE(CFURLSTORAGESESSIONS)
+    if (CFURLStorageSessionRef storageSession = ResourceHandle::privateBrowsingStorageSession())
+        cache.adoptCF(wkCopyURLCache(storageSession));
+    else
+#endif
+        cache.adoptCF(CFURLCacheCopySharedURLCache());
 
     RetainPtr<CFCachedURLResponseRef> cachedResponse(AdoptCF, CFURLCacheCopyResponseForRequest(cache.get(), request.get()));
     
index a3d65e9fe08e1766a6aa6b1068c3823c6c559dcf..d89e9dac1320a8316562e1d25c9b15d99c171bde 100644 (file)
@@ -1,3 +1,21 @@
+2011-03-04  Jessie Berlin  <jberlin@apple.com>
+
+        Reviewed by Maciej Stachowiak.
+
+        WebKit2: Use CFNetwork Sessions API.
+        https://bugs.webkit.org/show_bug.cgi?id=55435.
+
+        When Private Browsing is enabled, get the cached url response from the cache associated with
+        the Private Browsing Storage Session.
+
+        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-03  Jessie Berlin  <jberlin@apple.com>
 
         Reviewed by Adam Roben.
index efa78955c04aa1f4176ff9bf4146f55ba4aa35b5..cd5281fcf374bc4321a4642d0419740849190fb0 100644 (file)
@@ -236,6 +236,7 @@ CFStringRef WKCopyFoundationCacheDirectory(void);
 typedef const struct __CFURLStorageSession* CFURLStorageSessionRef;
 CFURLStorageSessionRef WKCreatePrivateStorageSession(CFStringRef);
 NSURLRequest *WKCopyRequestWithStorageSession(CFURLStorageSessionRef, NSURLRequest*);
+NSCachedURLResponse *WKCachedResponseForRequest(CFURLStorageSessionRef, NSURLRequest*);
 
 void WKSetVisibleApplicationName(CFStringRef);
 
index ba01d8a6b5be11f1bbe5803413ccaa6d8cef1389..c62157965c502a26e737cd910f39943be4176c5f 100644 (file)
Binary files a/WebKitLibraries/libWebKitSystemInterfaceLeopard.a and b/WebKitLibraries/libWebKitSystemInterfaceLeopard.a differ
index 3f9bf210f91ac71a76f4129019af19d7e4b3af01..dbda67e5d2674128d50cf432e70dd9b4d3a958db 100644 (file)
Binary files a/WebKitLibraries/libWebKitSystemInterfaceSnowLeopard.a and b/WebKitLibraries/libWebKitSystemInterfaceSnowLeopard.a differ
index 575ef5c6d144625ded2bf740b772f45352e20649..28b27041068ff3e93f97368de2c7b13726b05e8e 100644 (file)
@@ -65,6 +65,7 @@ typedef struct _CAImageQueue *CAImageQueueRef;
 typedef unsigned long CFTypeID;
 typedef struct _CFURLCredential* WKCFURLCredentialRef;
 typedef const struct __CFURLStorageSession* CFURLStorageSessionRef;
+typedef const struct _CFURLCache* CFURLCacheRef;
 
 void wkSetFontSmoothingLevel(int type);
 int wkGetFontSmoothingLevel();
@@ -98,6 +99,7 @@ void wkCFURLRequestSetHTTPRequestBodyParts(CFMutableURLRequestRef, CFArrayRef bo
 
 CFURLStorageSessionRef wkCreatePrivateStorageSession(CFStringRef identifier);
 void wkSetRequestStorageSession(CFURLStorageSessionRef, CFMutableURLRequestRef);
+CFURLCacheRef wkCopyURLCache(CFURLStorageSessionRef);
 
 CFArrayRef wkCFURLCacheCopyAllHostNamesInPersistentStore();
 void wkCFURLCacheDeleteHostNamesInPersistentStore(CFArrayRef hostNames);
index 5ab1d7c3874044f3962a21d2f4aeff838b240c24..50e54439bd9929924de1a2828824dfa8010076be 100644 (file)
Binary files a/WebKitLibraries/win/lib/WebKitSystemInterface.lib and b/WebKitLibraries/win/lib/WebKitSystemInterface.lib differ