Changeset 72303 in webkit
- Timestamp:
- Nov 18, 2010 9:59:53 AM (13 years ago)
- Location:
- trunk
- Files:
-
- 6 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r72302 r72303 1 2010-11-18 Joseph Pecoraro <joepeck@webkit.org> 2 3 Reviewed by Darin Adler. 4 5 Allow no-store resources to be used for back navigation 6 https://bugs.webkit.org/show_bug.cgi?id=49672 7 8 Add tests for checking if the cache was used for a "Cache-control: no-store" 9 resource in back navigation, reload navigation, and normal navigation. 10 11 * http/tests/cache/history-only-cached-subresource-loads-expected.txt: Added. 12 * http/tests/cache/history-only-cached-subresource-loads.html: Added. 13 * http/tests/cache/resources/no-store-resource-forward.html: Added. 14 * http/tests/cache/resources/no-store-resource-next.html: Added. 15 * http/tests/cache/resources/no-store-resource.html: Added. 16 * http/tests/cache/resources/random.cgi: Added. 17 1 18 2010-11-18 Tony Chang <tony@chromium.org> 2 19 -
trunk/WebCore/ChangeLog
r72301 r72303 1 2010-11-18 Joseph Pecoraro <joepeck@webkit.org> 2 3 Reviewed by Darin Adler. 4 5 Allow no-store resources to be used for back navigation 6 https://bugs.webkit.org/show_bug.cgi?id=49672 7 8 Test: http/tests/cache/history-only-cached-subresource-loads.html 9 10 HTTP allows "Cache-Control: no-store" resources to "cached" for the 11 purposes of history, such as back/forward navigation. Previously 12 WebCore just immediately evicted these resources, now we leave them in 13 the cache as long as they are not "https". This allows us to use them 14 if they are used in a back navigation, or lazily evict and replace 15 them on other load types expecting non-stale resources. 16 17 (WebCore::CachedResource::CachedResource): 18 (WebCore::CachedResource::removeClient): instead of immediately removing the resource from the cache, leave it in the cache. 19 * loader/cache/CachedResourceLoader.cpp: 20 (WebCore::CachedResourceLoader::checkForReload): 21 (WebCore::CachedResourceLoader::requestResource): allow history only resources if the CachePolicy is CachePolicyHistoryBuffer (back/forward navigation). 22 * loader/cache/MemoryCache.cpp: 23 (WebCore::MemoryCache::requestResource): lazily remove history only resources if it is requested for a load type expecting non-stale resources. 24 * loader/cache/MemoryCache.h: default the forHistory parameter to false. 25 26 Rename cache policy CachePolicyAllowStale to CachePolicyHistoryBuffer. 27 28 * loader/FrameLoader.cpp: 29 (WebCore::FrameLoader::subresourceCachePolicy): 30 * loader/cache/CachePolicy.h: 31 * loader/cache/CachedResource.cpp: 32 1 33 2010-11-18 Alexey Proskuryakov <ap@apple.com> 2 34 -
trunk/WebCore/loader/FrameLoader.cpp
r72137 r72303 2320 2320 2321 2321 if (request.cachePolicy() == ReturnCacheDataElseLoad) 2322 return CachePolicy AllowStale;2322 return CachePolicyHistoryBuffer; 2323 2323 2324 2324 return CachePolicyVerify; -
trunk/WebCore/loader/cache/CachePolicy.h
r71496 r72303 34 34 CachePolicyRevalidate, 35 35 CachePolicyReload, 36 CachePolicy AllowStale36 CachePolicyHistoryBuffer 37 37 }; 38 38 -
trunk/WebCore/loader/cache/CachedResource.cpp
r72230 r72303 253 253 if (response().cacheControlContainsNoStore()) { 254 254 // RFC2616 14.9.2: 255 // "no-store: ...MUST make a best-effort attempt to remove the information from volatile storage as promptly as possible" 256 cache()->remove(this); 255 // "no-store: ... MUST make a best-effort attempt to remove the information from volatile storage as promptly as possible" 256 // "... History buffers MAY store such responses as part of their normal operation." 257 // We allow non-secure content to be reused in history, but we do not allow secure content to be reused. 258 if (protocolIs(url(), "https")) 259 cache()->remove(this); 257 260 } else 258 261 cache()->prune(); -
trunk/WebCore/loader/cache/CachedResourceLoader.cpp
r71503 r72303 114 114 cache()->revalidateResource(existing, this); 115 115 break; 116 case CachePolicy AllowStale:116 case CachePolicyHistoryBuffer: 117 117 return; 118 118 } … … 264 264 checkForReload(fullURL); 265 265 266 CachedResource* resource = cache()->requestResource(this, type, fullURL, charset, isPreload); 266 bool allowForHistoryOnlyResources = cachePolicy() == CachePolicyHistoryBuffer; 267 CachedResource* resource = cache()->requestResource(this, type, fullURL, charset, isPreload, allowForHistoryOnlyResources); 267 268 if (resource) { 268 269 // Check final URL of resource to catch redirects. -
trunk/WebCore/loader/cache/MemoryCache.cpp
r71503 r72303 95 95 } 96 96 97 CachedResource* MemoryCache::requestResource(CachedResourceLoader* cachedResourceLoader, CachedResource::Type type, const KURL& url, const String& charset, bool requestIsPreload )98 { 99 LOG(ResourceLoading, "MemoryCache::requestResource '%s', charset '%s', preload=%u ", url.string().latin1().data(), charset.latin1().data(), requestIsPreload);97 CachedResource* MemoryCache::requestResource(CachedResourceLoader* cachedResourceLoader, CachedResource::Type type, const KURL& url, const String& charset, bool requestIsPreload, bool forHistory) 98 { 99 LOG(ResourceLoading, "MemoryCache::requestResource '%s', charset '%s', preload=%u, forHistory=%u", url.string().latin1().data(), charset.latin1().data(), requestIsPreload, forHistory); 100 100 101 101 // FIXME: Do we really need to special-case an empty URL? … … 106 106 // Look up the resource in our map. 107 107 CachedResource* resource = resourceForURL(url.string()); 108 109 // Non https "no-store" resources are left in the cache to be used for back/forward navigation only. 110 // If this is not a request forHistory and the resource was served with "no-store" we should evict 111 // it here and make a fresh request. 112 if (!forHistory && resource && resource->response().cacheControlContainsNoStore()) { 113 LOG(ResourceLoading, "MemoryCache::requestResource cleared a for history only resource due to a non-history request for the resource"); 114 evict(resource); 115 resource = 0; 116 } 108 117 109 118 if (resource && requestIsPreload && !resource->isPreloaded()) { -
trunk/WebCore/loader/cache/MemoryCache.h
r71499 r72303 110 110 // Request resources from the cache. A load will be initiated and a cache object created if the object is not 111 111 // found in the cache. 112 CachedResource* requestResource(CachedResourceLoader*, CachedResource::Type, const KURL& url, const String& charset, bool isPreload = false );112 CachedResource* requestResource(CachedResourceLoader*, CachedResource::Type, const KURL& url, const String& charset, bool isPreload = false, bool forHistory = false); 113 113 114 114 CachedCSSStyleSheet* requestUserCSSStyleSheet(CachedResourceLoader*, const String& url, const String& charset);
Note: See TracChangeset
for help on using the changeset viewer.