Don't cache resources that are very unlikely to be reused
authorantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 30 Mar 2015 22:00:17 +0000 (22:00 +0000)
committerantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 30 Mar 2015 22:00:17 +0000 (22:00 +0000)
https://bugs.webkit.org/show_bug.cgi?id=143226

Reviewed by Chris Dumez.

Source/WebKit2:

Follow-up to cover Cache-control: no-cache case which also has zero cache lifetime.

* NetworkProcess/cache/NetworkCache.cpp:
(WebKit::NetworkCache::makeStoreDecision):

LayoutTests:

* http/tests/cache/disk-cache/disk-cache-validation-back-navigation-policy-expected.txt:

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

LayoutTests/ChangeLog
LayoutTests/http/tests/cache/disk-cache/disk-cache-validation-back-navigation-policy-expected.txt
Source/WebKit2/ChangeLog
Source/WebKit2/NetworkProcess/cache/NetworkCache.cpp

index 1ce369f..09e7504 100644 (file)
@@ -2,6 +2,15 @@
 
         Don't cache resources that are very unlikely to be reused
         https://bugs.webkit.org/show_bug.cgi?id=143226
+
+        Reviewed by Chris Dumez.
+
+        * http/tests/cache/disk-cache/disk-cache-validation-back-navigation-policy-expected.txt:
+
+2015-03-30  Antti Koivisto  <antti@apple.com>
+
+        Don't cache resources that are very unlikely to be reused
+        https://bugs.webkit.org/show_bug.cgi?id=143226
         <rdar://problem/20347160>
 
         Reviewed by Geoff Garen.
index a5de237..ef1cb33 100644 (file)
@@ -30,7 +30,7 @@ response headers: {"Cache-control":"max-age=0, no-cache"}
 response source: Network
 
 response headers: {"Cache-control":"max-age=100, no-cache"}
-response source: Disk cache
+response source: Network
 
 response headers: {"ETag":"match"}
 response source: Disk cache
@@ -111,7 +111,7 @@ response headers: {"Cache-control":"max-age=0, no-cache, must-revalidate"}
 response source: Network
 
 response headers: {"Cache-control":"max-age=100, no-cache, must-revalidate"}
-response source: Disk cache
+response source: Network
 
 response headers: {"ETag":"match","Cache-control":"must-revalidate"}
 response source: Disk cache
index 56474cd..d810c57 100644 (file)
@@ -1,5 +1,17 @@
 2015-03-30  Antti Koivisto  <antti@apple.com>
 
+        Don't cache resources that are very unlikely to be reused
+        https://bugs.webkit.org/show_bug.cgi?id=143226
+
+        Reviewed by Chris Dumez.
+
+        Follow-up to cover Cache-control: no-cache case which also has zero cache lifetime.
+
+        * NetworkProcess/cache/NetworkCache.cpp:
+        (WebKit::NetworkCache::makeStoreDecision):
+
+2015-03-30  Antti Koivisto  <antti@apple.com>
+
         Include cache entry worth to json dump
         https://bugs.webkit.org/show_bug.cgi?id=143202
 
index d8a6cf8..a511914 100644 (file)
@@ -279,7 +279,7 @@ static StoreDecision makeStoreDecision(const WebCore::ResourceRequest& originalR
     bool storeUnconditionallyForHistoryNavigation = originalRequest.priority() == WebCore::ResourceLoadPriorityVeryHigh;
     if (!storeUnconditionallyForHistoryNavigation) {
         auto currentTime = std::chrono::duration<double>(std::chrono::system_clock::now().time_since_epoch());
-        bool hasNonZeroLifetime = WebCore::computeFreshnessLifetimeForHTTPFamily(response, currentTime.count()) > 0;
+        bool hasNonZeroLifetime = !response.cacheControlContainsNoCache() && WebCore::computeFreshnessLifetimeForHTTPFamily(response, currentTime.count()) > 0;
 
         bool possiblyReusable = response.hasCacheValidatorFields() || hasNonZeroLifetime;
         if (!possiblyReusable)