Stop using ResourceRequest::cachePolicy() in FrameLoader::subresourceCachePolicy()
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 8 Dec 2014 18:42:12 +0000 (18:42 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 8 Dec 2014 18:42:12 +0000 (18:42 +0000)
https://bugs.webkit.org/show_bug.cgi?id=139350

Reviewed by Antti Koivisto.

Stop using ResourceRequest::cachePolicy() in FrameLoader::subresourceCachePolicy()
and use m_loadType instead. ResourceRequest::cachePolicy() is meant to be passed
to the network stack, and isn't supposed to be used as input inside WebCore.

No new tests, no behavior change.

* loader/FrameLoader.cpp:
(WebCore::FrameLoader::subresourceCachePolicy):

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

Source/WebCore/ChangeLog
Source/WebCore/loader/FrameLoader.cpp

index f5e8f12..9230ac2 100644 (file)
@@ -1,3 +1,19 @@
+2014-12-08  Chris Dumez  <cdumez@apple.com>
+
+        Stop using ResourceRequest::cachePolicy() in FrameLoader::subresourceCachePolicy()
+        https://bugs.webkit.org/show_bug.cgi?id=139350
+
+        Reviewed by Antti Koivisto.
+
+        Stop using ResourceRequest::cachePolicy() in FrameLoader::subresourceCachePolicy()
+        and use m_loadType instead. ResourceRequest::cachePolicy() is meant to be passed
+        to the network stack, and isn't supposed to be used as input inside WebCore.
+
+        No new tests, no behavior change.
+
+        * loader/FrameLoader.cpp:
+        (WebCore::FrameLoader::subresourceCachePolicy):
+
 2014-12-08  Philippe Normand  <pnormand@igalia.com>
 
         [GTK] UserMedia Permission Request API
index cebb3aa..dae60a5 100644 (file)
@@ -2148,14 +2148,22 @@ CachePolicy FrameLoader::subresourceCachePolicy() const
             return parentCachePolicy;
     }
     
-    if (m_loadType == FrameLoadType::Reload)
+    switch (m_loadType) {
+    case FrameLoadType::Reload:
         return CachePolicyRevalidate;
-
-    const ResourceRequest& request(documentLoader()->request());
-    if (request.cachePolicy() == ReturnCacheDataElseLoad)
+    case FrameLoadType::Back:
+    case FrameLoadType::Forward:
+    case FrameLoadType::IndexedBackForward:
         return CachePolicyHistoryBuffer;
-
-    return CachePolicyVerify;
+    case FrameLoadType::ReloadFromOrigin:
+        ASSERT_NOT_REACHED(); // Already handled above.
+        return CachePolicyReload;
+    case FrameLoadType::RedirectWithLockedBackForwardList:
+    case FrameLoadType::Replace:
+    case FrameLoadType::Same:
+    case FrameLoadType::Standard:
+        return CachePolicyVerify;
+    }
 }
 
 void FrameLoader::checkLoadCompleteForThisFrame()