Changeset 181734 in webkit
- Timestamp:
- Mar 19, 2015, 12:54:06 AM (11 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/http/tests/cache/disk-cache-validation-back-navigation-policy-expected.txt (modified) (6 diffs)
-
Source/WebKit2/ChangeLog (modified) (1 diff)
-
Source/WebKit2/NetworkProcess/cache/NetworkCache.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r181732 r181734 1 2015-03-19 Chris Dumez <cdumez@apple.com> 2 3 The network cache should ignore "cache-control: no-cache, must-revalidate" on history navigation 4 https://bugs.webkit.org/show_bug.cgi?id=142831 5 <rdar://problem/20209957> 6 7 Reviewed by Antti Koivisto. 8 9 Rebaseline disk-cache-validation-back-navigation-policy.html test now 10 that we ignore "cache-control: no-cache, must-revalidate" on history 11 navigation. This is a progression. 12 13 * http/tests/cache/disk-cache-validation-back-navigation-policy-expected.txt: 14 1 15 2015-03-18 Brent Fulgham <bfulgham@apple.com> 2 16 -
trunk/LayoutTests/http/tests/cache/disk-cache-validation-back-navigation-policy-expected.txt
r181728 r181734 25 25 26 26 response headers: {"Cache-control":"no-cache"} 27 response source: Network27 response source: Disk cache 28 28 29 29 response headers: {"Cache-control":"max-age=0, no-cache"} 30 response source: Network30 response source: Disk cache 31 31 32 32 response headers: {"Cache-control":"max-age=100, no-cache"} 33 response source: Network33 response source: Disk cache 34 34 35 35 response headers: {"ETag":"match"} … … 52 52 53 53 response headers: {"Cache-control":"no-cache","ETag":"match"} 54 response source: Disk cache after validation54 response source: Disk cache 55 55 56 56 response headers: {"Cache-control":"max-age=0, no-cache","ETag":"match"} 57 response source: Disk cache after validation57 response source: Disk cache 58 58 59 59 response headers: {"Cache-control":"max-age=100, no-cache","ETag":"match"} 60 response source: Disk cache after validation60 response source: Disk cache 61 61 62 62 response headers: {"ETag":"nomatch"} … … 79 79 80 80 response headers: {"Cache-control":"no-cache","ETag":"nomatch"} 81 response source: Network81 response source: Disk cache 82 82 83 83 response headers: {"Cache-control":"max-age=0, no-cache","ETag":"nomatch"} 84 response source: Network84 response source: Disk cache 85 85 86 86 response headers: {"Cache-control":"max-age=100, no-cache","ETag":"nomatch"} 87 response source: Network87 response source: Disk cache 88 88 89 89 response headers: {"Cache-control":"must-revalidate"} 90 response source: Network90 response source: Disk cache 91 91 92 92 response headers: {"Cache-control":"max-age=0, must-revalidate"} 93 response source: Network93 response source: Disk cache 94 94 95 95 response headers: {"Cache-control":"max-age=100, must-revalidate"} … … 106 106 107 107 response headers: {"Cache-control":"no-cache, must-revalidate"} 108 response source: Network108 response source: Disk cache 109 109 110 110 response headers: {"Cache-control":"max-age=0, no-cache, must-revalidate"} 111 response source: Network111 response source: Disk cache 112 112 113 113 response headers: {"Cache-control":"max-age=100, no-cache, must-revalidate"} 114 response source: Network114 response source: Disk cache 115 115 116 116 response headers: {"ETag":"match","Cache-control":"must-revalidate"} 117 response source: Disk cache after validation117 response source: Disk cache 118 118 119 119 response headers: {"Cache-control":"max-age=0, must-revalidate","ETag":"match"} 120 response source: Disk cache after validation120 response source: Disk cache 121 121 122 122 response headers: {"Cache-control":"max-age=100, must-revalidate","ETag":"match"} … … 133 133 134 134 response headers: {"Cache-control":"no-cache, must-revalidate","ETag":"match"} 135 response source: Disk cache after validation135 response source: Disk cache 136 136 137 137 response headers: {"Cache-control":"max-age=0, no-cache, must-revalidate","ETag":"match"} 138 response source: Disk cache after validation138 response source: Disk cache 139 139 140 140 response headers: {"Cache-control":"max-age=100, no-cache, must-revalidate","ETag":"match"} 141 response source: Disk cache after validation141 response source: Disk cache 142 142 143 143 response headers: {"ETag":"nomatch","Cache-control":"must-revalidate"} 144 response source: Network144 response source: Disk cache 145 145 146 146 response headers: {"Cache-control":"max-age=0, must-revalidate","ETag":"nomatch"} 147 response source: Network147 response source: Disk cache 148 148 149 149 response headers: {"Cache-control":"max-age=100, must-revalidate","ETag":"nomatch"} … … 160 160 161 161 response headers: {"Cache-control":"no-cache, must-revalidate","ETag":"nomatch"} 162 response source: Network162 response source: Disk cache 163 163 164 164 response headers: {"Cache-control":"max-age=0, no-cache, must-revalidate","ETag":"nomatch"} 165 response source: Network165 response source: Disk cache 166 166 167 167 response headers: {"Cache-control":"max-age=100, no-cache, must-revalidate","ETag":"nomatch"} 168 response source: Network168 response source: Disk cache 169 169 170 170 PASS successfullyParsed is true -
trunk/Source/WebKit2/ChangeLog
r181721 r181734 1 2015-03-19 Chris Dumez <cdumez@apple.com> 2 3 The network cache should ignore "cache-control: no-cache, must-revalidate" on history navigation 4 https://bugs.webkit.org/show_bug.cgi?id=142831 5 <rdar://problem/20209957> 6 7 Reviewed by Antti Koivisto. 8 9 The network cache should ignore "no-cache" and "must-revalidate" as 10 Cache-Control policy for history navigations to avoid unnecessary 11 revalidation in this case. Our memory cache already behaves this way. 12 13 On history navigation, our disk cache implementation currently 14 revalidates unconditionally resources if "cache-control: no-cache" is 15 used. It also revalidates expired resources if "cache-control: 16 must-revalidate" is used. This is sub-optimal. 17 18 RFC 7234 does not require us to do so [1]: 19 """ 20 User agents often have history mechanisms, such as "Back" buttons and 21 history lists, that can be used to redisplay a representation 22 retrieved earlier in a session. 23 24 The freshness model (Section 4.2) does not necessarily apply to 25 history mechanisms. That is, a history mechanism can display a 26 previous representation even if it has expired. 27 """ 28 29 Chrome and IE9+ [2] already ignore "cache-control: must-revalidate" on history navigation. 30 31 [1] https://tools.ietf.org/html/rfc7234#page-32 32 [2] http://blogs.msdn.com/b/ie/archive/2010/07/14/caching-improvements-in-internet-explorer-9.aspx 33 34 Test: http/tests/cache/disk-cache-validation-back-navigation-policy.html 35 36 * NetworkProcess/cache/NetworkCache.cpp: 37 (WebKit::NetworkCache::decodeStorageEntry): 38 1 39 2015-03-18 Simon Fraser <simon.fraser@apple.com> 2 40 -
trunk/Source/WebKit2/NetworkProcess/cache/NetworkCache.cpp
r181689 r181734 207 207 } 208 208 209 bool allowExpired = cachePolicyAllowsExpired(request.cachePolicy()) && !cachedResponse.cacheControlContainsMustRevalidate();209 bool allowExpired = cachePolicyAllowsExpired(request.cachePolicy()); 210 210 auto timeStamp = std::chrono::duration_cast<std::chrono::duration<double>>(storageEntry.timeStamp); 211 211 double age = WebCore::computeCurrentAge(cachedResponse, timeStamp.count()); 212 212 double lifetime = WebCore::computeFreshnessLifetimeForHTTPFamily(cachedResponse, timeStamp.count()); 213 213 bool isExpired = age > lifetime; 214 bool needsRevalidation = (isExpired && !allowExpired) || cachedResponse.cacheControlContainsNoCache(); 214 // We never revalidate in the case of a history navigation (i.e. allowExpired is true). 215 bool needsRevalidation = !allowExpired && (cachedResponse.cacheControlContainsNoCache() || isExpired); 215 216 216 217 if (needsRevalidation) {
Note:
See TracChangeset
for help on using the changeset viewer.