Title: [138962] trunk/Source/WebCore
Revision
138962
Author
[email protected]
Date
2013-01-07 10:40:55 -0800 (Mon, 07 Jan 2013)

Log Message

        ResourceHandle::willLoadFromCache is evil
        https://bugs.webkit.org/show_bug.cgi?id=106147

        Reviewed by Brady Eidson.

        For back/forward navigations to a page that's a result of form submission, we may
        never silently re-submit the form. So, we show a warning dialog when about to re-submit,
        but try to load from cache if possible.

        This patch changes the logic so that we always try to fetch from cache, without
        any preflighting. If cache load fails, we restart the load as a known re-submit.

        No behavior change expected, so no tests.

        * html/HTMLAnchorElement.cpp: (WebCore::HTMLAnchorElement::handleClick):
        Added a FIXME.

        * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::startLoadingMainResource):
        Amended a FIXME with some information about why this call may still be needed.

        * loader/FrameLoader.h:
        * loader/FrameLoader.cpp:
        (WebCore::FrameLoader::loadURLIntoChildFrame): Pass an explicit argument for unchanged caching behavior.
        (WebCore::FrameLoader::reloadWithOverrideEncoding): Added a FIXME. This function
        can silently re-submit a form.
        (WebCore::FrameLoader::addExtraFieldsToMainResourceRequest): Added a FIXME about
        an incorrect use of current load type.
        (WebCore::FrameLoader::addExtraFieldsToRequest): Make sure that a correct caching
        policy is used for subresources even if main resource was loaded from cache. We
        didn't need that before because initial request had wrong extra fields due to a use
        of m_loadType when it was first called.
        Removed code to change caching policy for b/f navigations. This function does not
        have enough context to decide what the policy should be.
        (WebCore::FrameLoader::loadDifferentDocumentItem): Added an argument telling the
        function whether it should attempt loading from cache. It should do that on first
        attempt to navigate to a form submission result, but not if that failed.
        Pass a correct loadType - m_loadType is one for _previous_ load.
        Removed a special case for https - we've long stopped prohibiting caching of https
        resources, and using a resource that's already cached should definitely be allowed.
        (WebCore::FrameLoader::loadItem): Pass an explicit argument for unchanged caching behavior.
        (WebCore::FrameLoader::retryAfterFailedCacheOnlyMainResourceLoad): Added.

        * loader/MainResourceLoader.cpp: (WebCore::MainResourceLoader::notifyFinished):
        Removed a check for m_resource being null, because we were immediately dereferencing
        it anyway.
        Call retryAfterFailedCacheOnlyMainResourceLoad() to let FrameLoader restart the navigation.

        * platform/network/ResourceHandle.h:
        * platform/network/blackberry/ResourceHandleBlackBerry.cpp:
        * platform/network/cf/ResourceHandleCFNet.cpp:
        * platform/network/chromium/ResourceHandle.cpp:
        * platform/network/curl/ResourceHandleCurl.cpp:
        * platform/network/mac/ResourceHandleMac.mm:
        * platform/network/qt/ResourceHandleQt.cpp:
        * platform/network/soup/ResourceHandleSoup.cpp:
        * platform/network/win/ResourceHandleWin.cpp:
        Removed willLoadFromCache() - the new logic is cross-platform.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (138961 => 138962)


--- trunk/Source/WebCore/ChangeLog	2013-01-07 18:36:47 UTC (rev 138961)
+++ trunk/Source/WebCore/ChangeLog	2013-01-07 18:40:55 UTC (rev 138962)
@@ -1,3 +1,63 @@
+2013-01-04  Alexey Proskuryakov  <[email protected]>
+
+        ResourceHandle::willLoadFromCache is evil
+        https://bugs.webkit.org/show_bug.cgi?id=106147
+
+        Reviewed by Brady Eidson.
+
+        For back/forward navigations to a page that's a result of form submission, we may
+        never silently re-submit the form. So, we show a warning dialog when about to re-submit,
+        but try to load from cache if possible.
+
+        This patch changes the logic so that we always try to fetch from cache, without
+        any preflighting. If cache load fails, we restart the load as a known re-submit.
+
+        No behavior change expected, so no tests.
+
+        * html/HTMLAnchorElement.cpp: (WebCore::HTMLAnchorElement::handleClick):
+        Added a FIXME.
+
+        * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::startLoadingMainResource):
+        Amended a FIXME with some information about why this call may still be needed.
+
+        * loader/FrameLoader.h:
+        * loader/FrameLoader.cpp:
+        (WebCore::FrameLoader::loadURLIntoChildFrame): Pass an explicit argument for unchanged caching behavior.
+        (WebCore::FrameLoader::reloadWithOverrideEncoding): Added a FIXME. This function
+        can silently re-submit a form.
+        (WebCore::FrameLoader::addExtraFieldsToMainResourceRequest): Added a FIXME about
+        an incorrect use of current load type.
+        (WebCore::FrameLoader::addExtraFieldsToRequest): Make sure that a correct caching
+        policy is used for subresources even if main resource was loaded from cache. We
+        didn't need that before because initial request had wrong extra fields due to a use
+        of m_loadType when it was first called.
+        Removed code to change caching policy for b/f navigations. This function does not
+        have enough context to decide what the policy should be.
+        (WebCore::FrameLoader::loadDifferentDocumentItem): Added an argument telling the
+        function whether it should attempt loading from cache. It should do that on first
+        attempt to navigate to a form submission result, but not if that failed.
+        Pass a correct loadType - m_loadType is one for _previous_ load.
+        Removed a special case for https - we've long stopped prohibiting caching of https
+        resources, and using a resource that's already cached should definitely be allowed.
+        (WebCore::FrameLoader::loadItem): Pass an explicit argument for unchanged caching behavior.
+        (WebCore::FrameLoader::retryAfterFailedCacheOnlyMainResourceLoad): Added.
+
+        * loader/MainResourceLoader.cpp: (WebCore::MainResourceLoader::notifyFinished):
+        Removed a check for m_resource being null, because we were immediately dereferencing
+        it anyway.
+        Call retryAfterFailedCacheOnlyMainResourceLoad() to let FrameLoader restart the navigation.
+
+        * platform/network/ResourceHandle.h:
+        * platform/network/blackberry/ResourceHandleBlackBerry.cpp:
+        * platform/network/cf/ResourceHandleCFNet.cpp:
+        * platform/network/chromium/ResourceHandle.cpp:
+        * platform/network/curl/ResourceHandleCurl.cpp:
+        * platform/network/mac/ResourceHandleMac.mm:
+        * platform/network/qt/ResourceHandleQt.cpp:
+        * platform/network/soup/ResourceHandleSoup.cpp:
+        * platform/network/win/ResourceHandleWin.cpp:
+        Removed willLoadFromCache() - the new logic is cross-platform.
+
 2013-01-07  Alberto Garcia  <[email protected]>
 
         [GTK] Disable deprecation warnings for GStaticRecMutex

Modified: trunk/Source/WebCore/html/HTMLAnchorElement.cpp (138961 => 138962)


--- trunk/Source/WebCore/html/HTMLAnchorElement.cpp	2013-01-07 18:36:47 UTC (rev 138961)
+++ trunk/Source/WebCore/html/HTMLAnchorElement.cpp	2013-01-07 18:40:55 UTC (rev 138962)
@@ -512,6 +512,7 @@
     if (hasAttribute(downloadAttr)) {
         ResourceRequest request(kurl);
 
+        // FIXME: Why are we not calling addExtraFieldsToMainResourceRequest() if this check fails? It sets many important header fields.
         if (!hasRel(RelationNoReferrer)) {
             String referrer = SecurityPolicy::generateReferrerHeader(document()->referrerPolicy(), kurl, frame->loader()->outgoingReferrer());
             if (!referrer.isEmpty())

Modified: trunk/Source/WebCore/loader/DocumentLoader.cpp (138961 => 138962)


--- trunk/Source/WebCore/loader/DocumentLoader.cpp	2013-01-07 18:36:47 UTC (rev 138961)
+++ trunk/Source/WebCore/loader/DocumentLoader.cpp	2013-01-07 18:40:55 UTC (rev 138962)
@@ -884,6 +884,8 @@
 
     // FIXME: Is there any way the extra fields could have not been added by now?
     // If not, it would be great to remove this line of code.
+    // Note that currently, some requests may have incorrect extra fields even if this function has been called,
+    // because we pass a wrong loadType (see FIXME in addExtraFieldsToMainResourceRequest()).
     frameLoader()->addExtraFieldsToMainResourceRequest(m_request);
     m_mainResourceLoader->load(m_request, m_substituteData);
 

Modified: trunk/Source/WebCore/loader/FrameLoader.cpp (138961 => 138962)


--- trunk/Source/WebCore/loader/FrameLoader.cpp	2013-01-07 18:36:47 UTC (rev 138961)
+++ trunk/Source/WebCore/loader/FrameLoader.cpp	2013-01-07 18:40:55 UTC (rev 138962)
@@ -852,7 +852,7 @@
         && !m_frame->document()->loadEventFinished()) {
         HistoryItem* childItem = parentItem->childItemWithTarget(childFrame->tree()->uniqueName());
         if (childItem) {
-            childFrame->loader()->loadDifferentDocumentItem(childItem, loadType());
+            childFrame->loader()->loadDifferentDocumentItem(childItem, loadType(), MayAttemptCacheOnlyLoadForFormSubmissionItem);
             return;
         }
     }
@@ -1461,6 +1461,8 @@
     if (!unreachableURL.isEmpty())
         request.setURL(unreachableURL);
 
+    // FIXME: If the resource is a result of form submission and is not cached, the form will be silently resubmitted.
+    // We should ask the user for confirmation in this case.
     request.setCachePolicy(ReturnCacheDataElseLoad);
 
     RefPtr<DocumentLoader> loader = m_client->createDocumentLoader(request, defaultSubstituteDataForURL(request.url()));
@@ -2418,13 +2420,15 @@
 
 void FrameLoader::addExtraFieldsToMainResourceRequest(ResourceRequest& request)
 {
+    // FIXME: Using m_loadType seems wrong for some callers.
+    // If we are only preparing to load the main resource, that is previous load's load type!
     addExtraFieldsToRequest(request, m_loadType, true);
 }
 
 void FrameLoader::addExtraFieldsToRequest(ResourceRequest& request, FrameLoadType loadType, bool mainResource)
 {
     // Don't set the cookie policy URL if it's already been set.
-    // But make sure to set it on all requests, as it has significance beyond the cookie policy for all protocols (<rdar://problem/6616664>).
+    // But make sure to set it on all requests regardless of protocol, as it has significance beyond the cookie policy (<rdar://problem/6616664>).
     if (request.firstPartyForCookies().isEmpty()) {
         if (mainResource && isLoadingMainFrame())
             request.setFirstPartyForCookies(request.url());
@@ -2437,26 +2441,31 @@
         return;
 
     applyUserAgent(request);
-    
-    // If we inherit cache policy from a main resource, we use the DocumentLoader's 
-    // original request cache policy for two reasons:
-    // 1. For POST requests, we mutate the cache policy for the main resource,
-    //    but we do not want this to apply to subresources
-    // 2. Delegates that modify the cache policy using willSendRequest: should
-    //    not affect any other resources. Such changes need to be done
-    //    per request.
+
     if (!mainResource) {
         if (request.isConditional())
             request.setCachePolicy(ReloadIgnoringCacheData);
-        else if (documentLoader()->isLoadingInAPISense())
-            request.setCachePolicy(documentLoader()->originalRequest().cachePolicy());
-        else
+        else if (documentLoader()->isLoadingInAPISense()) {
+            // If we inherit cache policy from a main resource, we use the DocumentLoader's
+            // original request cache policy for two reasons:
+            // 1. For POST requests, we mutate the cache policy for the main resource,
+            //    but we do not want this to apply to subresources
+            // 2. Delegates that modify the cache policy using willSendRequest: should
+            //    not affect any other resources. Such changes need to be done
+            //    per request.
+            ResourceRequestCachePolicy mainDocumentOriginalCachePolicy = documentLoader()->originalRequest().cachePolicy();
+            // Back-forward navigations try to load main resource from cache only to avoid re-submitting form data, and start over (with a warning dialog) if that fails.
+            // This policy is set on initial request too, but should not be inherited.
+            ResourceRequestCachePolicy subresourceCachePolicy = (mainDocumentOriginalCachePolicy == ReturnCacheDataDontLoad) ? ReturnCacheDataElseLoad : mainDocumentOriginalCachePolicy;
+            request.setCachePolicy(subresourceCachePolicy);
+        } else
             request.setCachePolicy(UseProtocolCachePolicy);
+
+    // FIXME: Other FrameLoader functions have duplicated code for setting cache policy of main request when reloading.
+    // It seems better to manage it explicitly than to hide the logic inside addExtraFieldsToRequest().
     } else if (loadType == FrameLoadTypeReload || loadType == FrameLoadTypeReloadFromOrigin || request.isConditional())
         request.setCachePolicy(ReloadIgnoringCacheData);
-    else if (isBackForwardLoadType(loadType) && m_stateMachine.committedFirstRealDocumentLoad())
-        request.setCachePolicy(ReturnCacheDataElseLoad);
-        
+
     if (request.cachePolicy() == ReloadIgnoringCacheData) {
         if (loadType == FrameLoadTypeReload)
             request.setHTTPHeaderField("Cache-Control", "max-age=0");
@@ -3033,7 +3042,7 @@
 // FIXME: This function should really be split into a couple pieces, some of
 // which should be methods of HistoryController and some of which should be
 // methods of FrameLoader.
-void FrameLoader::loadDifferentDocumentItem(HistoryItem* item, FrameLoadType loadType)
+void FrameLoader::loadDifferentDocumentItem(HistoryItem* item, FrameLoadType loadType, FormSubmissionCacheLoadPolicy cacheLoadPolicy)
 {
     // Remember this item so we can traverse any child items as child frames load
     history()->setProvisionalItem(item);
@@ -3068,7 +3077,7 @@
 
         // Make sure to add extra fields to the request after the Origin header is added for the FormData case.
         // See https://bugs.webkit.org/show_bug.cgi?id=22194 for more discussion.
-        addExtraFieldsToRequest(request, m_loadType, true);
+        addExtraFieldsToRequest(request, loadType, true);
         
         // FIXME: Slight hack to test if the NSURL cache contains the page we're going to.
         // We want to know this before talking to the policy delegate, since it affects whether 
@@ -3078,10 +3087,11 @@
         // have the item vanish when we try to use it in the ensuing nav.  This should be
         // extremely rare, but in that case the user will get an error on the navigation.
         
-        if (ResourceHandle::willLoadFromCache(request, m_frame))
+        if (cacheLoadPolicy == MayAttemptCacheOnlyLoadForFormSubmissionItem) {
+            request.setCachePolicy(ReturnCacheDataDontLoad);
             action = "" loadType, false);
-        else {
-            request.setCachePolicy(ReloadIgnoringCacheData);
+        } else {
+            request.setCachePolicy(ReturnCacheDataElseLoad);
             action = "" NavigationTypeFormResubmitted);
         }
     } else {
@@ -3095,7 +3105,7 @@
             case FrameLoadTypeIndexedBackForward:
                 // If the first load within a frame is a navigation within a back/forward list that was attached 
                 // without any of the items being loaded then we should use the default caching policy (<rdar://problem/8131355>).
-                if (m_stateMachine.committedFirstRealDocumentLoad() && !itemURL.protocolIs("https"))
+                if (m_stateMachine.committedFirstRealDocumentLoad())
                     request.setCachePolicy(ReturnCacheDataElseLoad);
                 break;
             case FrameLoadTypeStandard:
@@ -3106,7 +3116,7 @@
                 ASSERT_NOT_REACHED();
         }
 
-        addExtraFieldsToRequest(request, m_loadType, true);
+        addExtraFieldsToRequest(request, loadType, true);
 
         ResourceRequest requestForOriginalURL(request);
         requestForOriginalURL.setURL(itemOriginalURL);
@@ -3126,9 +3136,25 @@
     if (sameDocumentNavigation)
         loadSameDocumentItem(item);
     else
-        loadDifferentDocumentItem(item, loadType);
+        loadDifferentDocumentItem(item, loadType, MayAttemptCacheOnlyLoadForFormSubmissionItem);
 }
 
+void FrameLoader::retryAfterFailedCacheOnlyMainResourceLoad()
+{
+    ASSERT(m_state == FrameStateProvisional);
+    ASSERT(!m_loadingFromCachedPage);
+    // We only use cache-only loads to avoid resubmitting forms.
+    ASSERT(isBackForwardLoadType(m_loadType));
+    ASSERT(m_history.provisionalItem()->formData());
+    ASSERT(m_history.provisionalItem() == m_requestedHistoryItem.get());
+
+    FrameLoadType loadType = m_loadType;
+    HistoryItem* item = m_history.provisionalItem();
+
+    stopAllLoaders(ShouldNotClearProvisionalItem);
+    loadDifferentDocumentItem(item, loadType, MayNotAttemptCacheOnlyLoadForFormSubmissionItem);
+}
+
 ResourceError FrameLoader::cancelledError(const ResourceRequest& request) const
 {
     ResourceError error = m_client->cancelledError(request);

Modified: trunk/Source/WebCore/loader/FrameLoader.h (138961 => 138962)


--- trunk/Source/WebCore/loader/FrameLoader.h	2013-01-07 18:36:47 UTC (rev 138961)
+++ trunk/Source/WebCore/loader/FrameLoader.h	2013-01-07 18:40:55 UTC (rev 138962)
@@ -123,6 +123,8 @@
     void loadItem(HistoryItem*, FrameLoadType);
     HistoryItem* requestedHistoryItem() const { return m_requestedHistoryItem.get(); }
 
+    void retryAfterFailedCacheOnlyMainResourceLoad();
+
     static void reportLocalLoadFailed(Frame*, const String& url);
 
     // FIXME: These are all functions which stop loads. We have too many.
@@ -282,12 +284,17 @@
     void reportMemoryUsage(MemoryObjectInfo*) const;
 
 private:
+    enum FormSubmissionCacheLoadPolicy {
+        MayAttemptCacheOnlyLoadForFormSubmissionItem,
+        MayNotAttemptCacheOnlyLoadForFormSubmissionItem
+    };
+
     bool allChildrenAreComplete() const; // immediate children, not all descendants
 
     void checkTimerFired(Timer<FrameLoader>*);
     
     void loadSameDocumentItem(HistoryItem*);
-    void loadDifferentDocumentItem(HistoryItem*, FrameLoadType);
+    void loadDifferentDocumentItem(HistoryItem*, FrameLoadType, FormSubmissionCacheLoadPolicy);
     
     void loadProvisionalItemFromCachedPage();
 

Modified: trunk/Source/WebCore/loader/MainResourceLoader.cpp (138961 => 138962)


--- trunk/Source/WebCore/loader/MainResourceLoader.cpp	2013-01-07 18:36:47 UTC (rev 138961)
+++ trunk/Source/WebCore/loader/MainResourceLoader.cpp	2013-01-07 18:40:55 UTC (rev 138962)
@@ -550,11 +550,17 @@
 void MainResourceLoader::notifyFinished(CachedResource* resource)
 {
     ASSERT_UNUSED(resource, m_resource == resource);
-    if (!m_resource || (!m_resource->errorOccurred() && !m_resource->wasCanceled())) {
+    ASSERT(m_resource);
+    if (!m_resource->errorOccurred() && !m_resource->wasCanceled()) {
         didFinishLoading(m_resource->loadFinishTime());
         return;
     }
 
+    if (m_documentLoader->request().cachePolicy() == ReturnCacheDataDontLoad && !m_resource->wasCanceled()) {
+        frameLoader()->retryAfterFailedCacheOnlyMainResourceLoad();
+        return;
+    }
+
 #if PLATFORM(MAC) && !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080
     if (m_filter) {
         wkFilterRelease(m_filter);

Modified: trunk/Source/WebCore/platform/network/ResourceHandle.h (138961 => 138962)


--- trunk/Source/WebCore/platform/network/ResourceHandle.h	2013-01-07 18:36:47 UTC (rev 138961)
+++ trunk/Source/WebCore/platform/network/ResourceHandle.h	2013-01-07 18:40:55 UTC (rev 138962)
@@ -104,7 +104,6 @@
     static PassRefPtr<ResourceHandle> create(NetworkingContext*, const ResourceRequest&, ResourceHandleClient*, bool defersLoading, bool shouldContentSniff);
     static void loadResourceSynchronously(NetworkingContext*, const ResourceRequest&, StoredCredentials, ResourceError&, ResourceResponse&, Vector<char>& data);
 
-    static bool willLoadFromCache(ResourceRequest&, Frame*);
     static void cacheMetadata(const ResourceResponse&, const Vector<char>&);
 
     virtual ~ResourceHandle();

Modified: trunk/Source/WebCore/platform/network/blackberry/ResourceHandleBlackBerry.cpp (138961 => 138962)


--- trunk/Source/WebCore/platform/network/blackberry/ResourceHandleBlackBerry.cpp	2013-01-07 18:36:47 UTC (rev 138961)
+++ trunk/Source/WebCore/platform/network/blackberry/ResourceHandleBlackBerry.cpp	2013-01-07 18:40:55 UTC (rev 138962)
@@ -126,12 +126,6 @@
         NetworkManager::instance()->pauseLoad(this, pause);
 }
 
-bool ResourceHandle::willLoadFromCache(ResourceRequest&, Frame*)
-{
-    notImplemented();
-    return false;
-}
-
 void ResourceHandle::cancel()
 {
     NetworkManager::instance()->stopJob(this);

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


--- trunk/Source/WebCore/platform/network/cf/ResourceHandleCFNet.cpp	2013-01-07 18:36:47 UTC (rev 138961)
+++ trunk/Source/WebCore/platform/network/cf/ResourceHandleCFNet.cpp	2013-01-07 18:40:55 UTC (rev 138962)
@@ -808,23 +808,6 @@
     return false;
 }
 
-bool ResourceHandle::willLoadFromCache(ResourceRequest& request, Frame*)
-{
-    request.setCachePolicy(ReturnCacheDataDontLoad);
-    
-    CFURLResponseRef cfResponse = 0;
-    CFErrorRef cfError = 0;
-    RetainPtr<CFDataRef> data = "" &cfResponse, &cfError, request.timeoutInterval()));
-    bool cached = cfResponse && !cfError;
-
-    if (cfError)
-        CFRelease(cfError);
-    if (cfResponse)
-        CFRelease(cfResponse);
-
-    return cached;
-}
-
 #if PLATFORM(MAC)
 void ResourceHandle::schedule(SchedulePair* pair)
 {

Modified: trunk/Source/WebCore/platform/network/chromium/ResourceHandle.cpp (138961 => 138962)


--- trunk/Source/WebCore/platform/network/chromium/ResourceHandle.cpp	2013-01-07 18:36:47 UTC (rev 138961)
+++ trunk/Source/WebCore/platform/network/chromium/ResourceHandle.cpp	2013-01-07 18:40:55 UTC (rev 138962)
@@ -277,22 +277,6 @@
 }
 
 // static
-bool ResourceHandle::willLoadFromCache(ResourceRequest& request, Frame*)
-{
-    // This method is used to determine if a POST request can be repeated from
-    // cache, but you cannot really know until you actually try to read from the
-    // cache. Even if we checked now, something else could come along and wipe
-    // out the cache entry by the time we fetch it.
-    //
-    // So, we always say yes here, to prevent the FrameLoader from initiating a
-    // reload. Then in FrameLoaderClientImpl::dispatchWillSendRequest, we
-    // fix-up the cache policy of the request to force a load from the cache.
-    //
-    ASSERT(request.httpMethod() == "POST");
-    return true;
-}
-
-// static
 void ResourceHandle::cacheMetadata(const ResourceResponse& response, const Vector<char>& data)
 {
     WebKit::Platform::current()->cacheMetadata(response.url(), response.responseTime(), data.data(), data.size());

Modified: trunk/Source/WebCore/platform/network/curl/ResourceHandleCurl.cpp (138961 => 138962)


--- trunk/Source/WebCore/platform/network/curl/ResourceHandleCurl.cpp	2013-01-07 18:36:47 UTC (rev 138961)
+++ trunk/Source/WebCore/platform/network/curl/ResourceHandleCurl.cpp	2013-01-07 18:40:55 UTC (rev 138962)
@@ -166,12 +166,6 @@
 #endif
 }
 
-bool ResourceHandle::willLoadFromCache(ResourceRequest&, Frame*)
-{
-    notImplemented();
-    return false;
-}
-
 bool ResourceHandle::loadsBlocked()
 {
     notImplemented();

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


--- trunk/Source/WebCore/platform/network/mac/ResourceHandleMac.mm	2013-01-07 18:36:47 UTC (rev 138961)
+++ trunk/Source/WebCore/platform/network/mac/ResourceHandleMac.mm	2013-01-07 18:40:55 UTC (rev 138962)
@@ -357,19 +357,6 @@
     return false;
 }
 
-bool ResourceHandle::willLoadFromCache(ResourceRequest& request, Frame*)
-{
-    request.setCachePolicy(ReturnCacheDataDontLoad);
-    NSURLResponse *nsURLResponse = nil;
-    BEGIN_BLOCK_OBJC_EXCEPTIONS;
-
-    [NSURLConnection sendSynchronousRequest:request.nsURLRequest() returningResponse:&nsURLResponse error:nil];
-    
-    END_BLOCK_OBJC_EXCEPTIONS;
-    
-    return nsURLResponse;
-}
-
 CFStringRef ResourceHandle::synchronousLoadRunLoopMode()
 {
     return CFSTR("WebCoreSynchronousLoaderRunLoopMode");

Modified: trunk/Source/WebCore/platform/network/qt/ResourceHandleQt.cpp (138961 => 138962)


--- trunk/Source/WebCore/platform/network/qt/ResourceHandleQt.cpp	2013-01-07 18:36:47 UTC (rev 138961)
+++ trunk/Source/WebCore/platform/network/qt/ResourceHandleQt.cpp	2013-01-07 18:40:55 UTC (rev 138962)
@@ -125,30 +125,6 @@
     return false;
 }
 
-bool ResourceHandle::willLoadFromCache(ResourceRequest& request, Frame* frame)
-{
-    if (!frame)
-        return false;
-
-    QNetworkAccessManager* manager = 0;
-    QAbstractNetworkCache* cache = 0;
-    if (frame->loader()->networkingContext()) {
-        manager = frame->loader()->networkingContext()->networkAccessManager();
-        cache = manager->cache();
-    }
-
-    if (!cache)
-        return false;
-
-    QNetworkCacheMetaData data = ""
-    if (data.isValid()) {
-        request.setCachePolicy(ReturnCacheDataDontLoad);
-        return true;
-    }
-
-    return false;
-}
-
 void ResourceHandle::loadResourceSynchronously(NetworkingContext* context, const ResourceRequest& request, StoredCredentials /*storedCredentials*/, ResourceError& error, ResourceResponse& response, Vector<char>& data)
 {
 #if ENABLE(BLOB)

Modified: trunk/Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp (138961 => 138962)


--- trunk/Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp	2013-01-07 18:36:47 UTC (rev 138961)
+++ trunk/Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp	2013-01-07 18:40:55 UTC (rev 138962)
@@ -1173,14 +1173,6 @@
     return false;
 }
 
-bool ResourceHandle::willLoadFromCache(ResourceRequest&, Frame*)
-{
-    // Not having this function means that we'll ask the user about re-posting a form
-    // even when we go back to a page that's still in the cache.
-    notImplemented();
-    return false;
-}
-
 void ResourceHandle::loadResourceSynchronously(NetworkingContext* context, const ResourceRequest& request, StoredCredentials /*storedCredentials*/, ResourceError& error, ResourceResponse& response, Vector<char>& data)
 {
 #if ENABLE(BLOB)

Modified: trunk/Source/WebCore/platform/network/win/ResourceHandleWin.cpp (138961 => 138962)


--- trunk/Source/WebCore/platform/network/win/ResourceHandleWin.cpp	2013-01-07 18:36:47 UTC (rev 138961)
+++ trunk/Source/WebCore/platform/network/win/ResourceHandleWin.cpp	2013-01-07 18:40:55 UTC (rev 138962)
@@ -431,12 +431,6 @@
     d->m_loadSynchronously = true;
 }
 
-bool ResourceHandle::willLoadFromCache(ResourceRequest&, Frame*)
-{
-    notImplemented();
-    return false;
-}
-
 void prefetchDNS(const String&)
 {
     notImplemented();
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to