Title: [136998] trunk/Source
Revision
136998
Author
a...@apple.com
Date
2012-12-07 16:38:32 -0800 (Fri, 07 Dec 2012)

Log Message

        There is no need to change cached resource storage policy through ResourceHandleClient
        https://bugs.webkit.org/show_bug.cgi?id=104413

        Reviewed by Brady Eidson.

        This code was only needed to prevent storing responses to disk in private browsing
        mode, but we now have a storage session to take care of that in a cleaner and more
        reliable way.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (136997 => 136998)


--- trunk/Source/WebCore/ChangeLog	2012-12-08 00:16:39 UTC (rev 136997)
+++ trunk/Source/WebCore/ChangeLog	2012-12-08 00:38:32 UTC (rev 136998)
@@ -1,3 +1,21 @@
+2012-12-07  Alexey Proskuryakov  <a...@apple.com>
+
+        There is no need to change cached resource storage policy through ResourceHandleClient
+        https://bugs.webkit.org/show_bug.cgi?id=104413
+
+        Reviewed by Brady Eidson.
+
+        This code was only needed to prevent storing responses to disk in private browsing
+        mode, but we now have a storage session to take care of that in a cleaner and more
+        reliable way.
+
+        * loader/ResourceLoader.cpp:
+        * loader/ResourceLoader.h: (WebCore::ResourceLoader::receivedCancellation):
+        * platform/network/ResourceHandleClient.h:
+        * platform/network/cf/ResourceHandleCFNet.cpp: (WebCore::willCacheResponse):
+        * platform/network/mac/ResourceHandleMac.mm:
+        (-[WebCoreResourceHandleAsDelegate connection:willCacheResponse:]):
+
 2012-12-07  Adam Klein  <ad...@chromium.org>
 
         MutationRecord addedNodes/removedNodes should never be null

Modified: trunk/Source/WebCore/loader/ResourceLoader.cpp (136997 => 136998)


--- trunk/Source/WebCore/loader/ResourceLoader.cpp	2012-12-08 00:16:39 UTC (rev 136997)
+++ trunk/Source/WebCore/loader/ResourceLoader.cpp	2012-12-08 00:38:32 UTC (rev 136998)
@@ -524,20 +524,6 @@
     cancel();
 }
 
-void ResourceLoader::willCacheResponse(ResourceHandle*, CacheStoragePolicy& policy)
-{
-    // <rdar://problem/7249553> - There are reports of crashes with this method being called
-    // with a null m_frame->settings(), which can only happen if the frame doesn't have a page.
-    // Sadly we have no reproducible cases of this.
-    // We think that any frame without a page shouldn't have any loads happening in it, yet
-    // there is at least one code path where that is not true.
-    ASSERT(m_frame->settings());
-    
-    // When in private browsing mode, prevent caching to disk
-    if (policy == StorageAllowed && m_frame->settings() && m_frame->settings()->privateBrowsingEnabled())
-        policy = StorageAllowedInMemoryOnly;    
-}
-
 #if ENABLE(BLOB)
 AsyncFileStream* ResourceLoader::createAsyncFileStream(FileStreamClient* client)
 {

Modified: trunk/Source/WebCore/loader/ResourceLoader.h (136997 => 136998)


--- trunk/Source/WebCore/loader/ResourceLoader.h	2012-12-08 00:16:39 UTC (rev 136997)
+++ trunk/Source/WebCore/loader/ResourceLoader.h	2012-12-08 00:38:32 UTC (rev 136998)
@@ -117,7 +117,6 @@
     virtual bool canAuthenticateAgainstProtectionSpace(ResourceHandle*, const ProtectionSpace& protectionSpace) { return canAuthenticateAgainstProtectionSpace(protectionSpace); }
 #endif
     virtual void receivedCancellation(ResourceHandle*, const AuthenticationChallenge& challenge) { receivedCancellation(challenge); }
-    virtual void willCacheResponse(ResourceHandle*, CacheStoragePolicy&);
 #if PLATFORM(MAC)
 #if USE(CFNETWORK)
     virtual CFCachedURLResponseRef willCacheResponse(ResourceHandle*, CFCachedURLResponseRef);

Modified: trunk/Source/WebCore/platform/network/ResourceHandleClient.h (136997 => 136998)


--- trunk/Source/WebCore/platform/network/ResourceHandleClient.h	2012-12-08 00:16:39 UTC (rev 136997)
+++ trunk/Source/WebCore/platform/network/ResourceHandleClient.h	2012-12-08 00:38:32 UTC (rev 136998)
@@ -82,8 +82,6 @@
         virtual void didReceiveDataArray(ResourceHandle*, CFArrayRef) { }
 #endif
 
-        virtual void willCacheResponse(ResourceHandle*, CacheStoragePolicy&) { }
-
         virtual bool shouldUseCredentialStorage(ResourceHandle*) { return false; }
         virtual void didReceiveAuthenticationChallenge(ResourceHandle*, const AuthenticationChallenge&) { }
         virtual void didCancelAuthenticationChallenge(ResourceHandle*, const AuthenticationChallenge&) { }

Modified: trunk/Source/WebCore/platform/network/cf/ResourceHandleCFNet.cpp (136997 => 136998)


--- trunk/Source/WebCore/platform/network/cf/ResourceHandleCFNet.cpp	2012-12-08 00:16:39 UTC (rev 136997)
+++ trunk/Source/WebCore/platform/network/cf/ResourceHandleCFNet.cpp	2012-12-08 00:38:32 UTC (rev 136998)
@@ -334,21 +334,8 @@
         return newResponse;
 #endif
 
-    CacheStoragePolicy policy = static_cast<CacheStoragePolicy>(CFCachedURLResponseGetStoragePolicy(cachedResponse));
+    CFRetain(cachedResponse);
 
-    if (handle->client())
-        handle->client()->willCacheResponse(handle, policy);
-
-    if (static_cast<CFURLCacheStoragePolicy>(policy) != CFCachedURLResponseGetStoragePolicy(cachedResponse)) {
-        RetainPtr<CFArrayRef> receiverData(AdoptCF, CFCachedURLResponseCopyReceiverDataArray(cachedResponse));
-        cachedResponse = CFCachedURLResponseCreateWithDataArray(kCFAllocatorDefault,
-                                                                wrappedResponse,
-                                                                receiverData.get(),
-                                                                CFCachedURLResponseGetUserInfo(cachedResponse),
-                                                                static_cast<CFURLCacheStoragePolicy>(policy));
-    } else
-        CFRetain(cachedResponse);
-
     return cachedResponse;
 }
 

Modified: trunk/Source/WebCore/platform/network/mac/ResourceHandleMac.mm (136997 => 136998)


--- trunk/Source/WebCore/platform/network/mac/ResourceHandleMac.mm	2012-12-08 00:16:39 UTC (rev 136997)
+++ trunk/Source/WebCore/platform/network/mac/ResourceHandleMac.mm	2012-12-08 00:38:32 UTC (rev 136998)
@@ -865,16 +865,6 @@
     if (newResponse != cachedResponse)
         return newResponse;
     
-    CacheStoragePolicy policy = static_cast<CacheStoragePolicy>([newResponse storagePolicy]);
-        
-    m_handle->client()->willCacheResponse(m_handle, policy);
-
-    if (static_cast<NSURLCacheStoragePolicy>(policy) != [newResponse storagePolicy])
-        newResponse = [[[NSCachedURLResponse alloc] initWithResponse:[newResponse response]
-                                                                data:[newResponse data]
-                                                            userInfo:[newResponse userInfo]
-                                                       storagePolicy:static_cast<NSURLCacheStoragePolicy>(policy)] autorelease];
-
     return newResponse;
 }
 

Modified: trunk/Source/WebKit2/ChangeLog (136997 => 136998)


--- trunk/Source/WebKit2/ChangeLog	2012-12-08 00:16:39 UTC (rev 136997)
+++ trunk/Source/WebKit2/ChangeLog	2012-12-08 00:38:32 UTC (rev 136998)
@@ -1,5 +1,16 @@
 2012-12-07  Alexey Proskuryakov  <a...@apple.com>
 
+        There is no need to change cached resource storage policy through ResourceHandleClient
+        https://bugs.webkit.org/show_bug.cgi?id=104413
+
+        Reviewed by Brady Eidson.
+
+        * NetworkProcess/NetworkResourceLoader.cpp:
+        * NetworkProcess/NetworkResourceLoader.h:
+        Deleted overrides of the removed willCacheResponse.
+
+2012-12-07  Alexey Proskuryakov  <a...@apple.com>
+
         Network process should use a correct storage session in private browsing mode
         <rdar://problem/12838490>
         https://bugs.webkit.org/show_bug.cgi?id=104401

Modified: trunk/Source/WebKit2/NetworkProcess/NetworkResourceLoader.cpp (136997 => 136998)


--- trunk/Source/WebKit2/NetworkProcess/NetworkResourceLoader.cpp	2012-12-08 00:16:39 UTC (rev 136997)
+++ trunk/Source/WebKit2/NetworkProcess/NetworkResourceLoader.cpp	2012-12-08 00:38:32 UTC (rev 136998)
@@ -234,13 +234,6 @@
     notImplemented();
 }
 
-void NetworkResourceLoader::willCacheResponse(WebCore::ResourceHandle*, WebCore::CacheStoragePolicy& policy)
-{
-    // FIXME (12838543): Unsure if this is needed, private session is in-memory anyway.
-    if (policy == StorageAllowed && m_requestParameters.inPrivateBrowsingMode())
-        policy = StorageAllowedInMemoryOnly;
-}
-
 bool NetworkResourceLoader::shouldUseCredentialStorage(ResourceHandle*)
 {
     // When the WebProcess is handling loading a client is consulted each time this shouldUseCredentialStorage question is asked.

Modified: trunk/Source/WebKit2/NetworkProcess/NetworkResourceLoader.h (136997 => 136998)


--- trunk/Source/WebKit2/NetworkProcess/NetworkResourceLoader.h	2012-12-08 00:16:39 UTC (rev 136997)
+++ trunk/Source/WebKit2/NetworkProcess/NetworkResourceLoader.h	2012-12-08 00:38:32 UTC (rev 136998)
@@ -80,7 +80,6 @@
     virtual void didFail(WebCore::ResourceHandle*, const WebCore::ResourceError&) OVERRIDE;
     virtual void wasBlocked(WebCore::ResourceHandle*) OVERRIDE;
     virtual void cannotShowURL(WebCore::ResourceHandle*) OVERRIDE;
-    virtual void willCacheResponse(WebCore::ResourceHandle*, WebCore::CacheStoragePolicy&) OVERRIDE;
     virtual bool shouldUseCredentialStorage(WebCore::ResourceHandle*) OVERRIDE;
     virtual void didReceiveAuthenticationChallenge(WebCore::ResourceHandle*, const WebCore::AuthenticationChallenge&) OVERRIDE;
     virtual void didCancelAuthenticationChallenge(WebCore::ResourceHandle*, const WebCore::AuthenticationChallenge&) OVERRIDE;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to