diff options
Diffstat (limited to 'WebCore/loader/cache/MemoryCache.cpp')
-rw-r--r-- | WebCore/loader/cache/MemoryCache.cpp | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/WebCore/loader/cache/MemoryCache.cpp b/WebCore/loader/cache/MemoryCache.cpp index bd42e5f..ae8e53a 100644 --- a/WebCore/loader/cache/MemoryCache.cpp +++ b/WebCore/loader/cache/MemoryCache.cpp @@ -95,9 +95,9 @@ static CachedResource* createResource(CachedResource::Type type, const KURL& url return 0; } -CachedResource* MemoryCache::requestResource(CachedResourceLoader* cachedResourceLoader, CachedResource::Type type, const KURL& url, const String& charset, bool requestIsPreload) +CachedResource* MemoryCache::requestResource(CachedResourceLoader* cachedResourceLoader, CachedResource::Type type, const KURL& url, const String& charset, bool requestIsPreload, bool forHistory) { - LOG(ResourceLoading, "MemoryCache::requestResource '%s', charset '%s', preload=%u", url.string().latin1().data(), charset.latin1().data(), requestIsPreload); + LOG(ResourceLoading, "MemoryCache::requestResource '%s', charset '%s', preload=%u, forHistory=%u", url.string().latin1().data(), charset.latin1().data(), requestIsPreload, forHistory); // FIXME: Do we really need to special-case an empty URL? // Would it be better to just go on with the cache code and let it fail later? @@ -107,6 +107,15 @@ CachedResource* MemoryCache::requestResource(CachedResourceLoader* cachedResourc // Look up the resource in our map. CachedResource* resource = resourceForURL(url.string()); + // Non https "no-store" resources are left in the cache to be used for back/forward navigation only. + // If this is not a request forHistory and the resource was served with "no-store" we should evict + // it here and make a fresh request. + if (!forHistory && resource && resource->response().cacheControlContainsNoStore()) { + LOG(ResourceLoading, "MemoryCache::requestResource cleared a for history only resource due to a non-history request for the resource"); + evict(resource); + resource = 0; + } + if (resource && requestIsPreload && !resource->isPreloaded()) { LOG(ResourceLoading, "MemoryCache::requestResource already has a preload request for this request, and it hasn't been preloaded yet"); return 0; @@ -118,7 +127,13 @@ CachedResource* MemoryCache::requestResource(CachedResourceLoader* cachedResourc FrameLoader::reportLocalLoadFailed(cachedResourceLoader->document()->frame(), url.string()); return 0; } - + + if (resource && resource->type() != type) { + LOG(ResourceLoading, "Cache::requestResource found a cache resource with matching url but different type, evicting and loading with new type."); + evict(resource); + resource = 0; + } + if (!resource) { LOG(ResourceLoading, "CachedResource for '%s' wasn't found in cache. Creating it", url.string().latin1().data()); // The resource does not exist. Create it. @@ -149,11 +164,6 @@ CachedResource* MemoryCache::requestResource(CachedResourceLoader* cachedResourc } } - if (resource->type() != type) { - LOG(ResourceLoading, "MemoryCache::requestResource cannot use cached resource for '%s' due to type mismatch", url.string().latin1().data()); - return 0; - } - if (!disabled()) { // This will move the resource to the front of its LRU list and increase its access count. resourceAccessed(resource); |