Chromium Code Reviews| Index: Source/core/fetch/ResourceFetcher.cpp |
| diff --git a/Source/core/fetch/ResourceFetcher.cpp b/Source/core/fetch/ResourceFetcher.cpp |
| index 240af5d6f13d2a0167cd8dd7c6fc9821acdab35f..42802199e5c8807187820a4024fffec54df53104 100644 |
| --- a/Source/core/fetch/ResourceFetcher.cpp |
| +++ b/Source/core/fetch/ResourceFetcher.cpp |
| @@ -763,6 +763,17 @@ ResourcePtr<Resource> ResourceFetcher::requestResource(Resource::Type type, Fetc |
| ASSERT(policy != Use || m_documentLoader->substituteData().isValid()); |
| ASSERT(policy != Revalidate); |
| memoryCache()->remove(resource.get()); |
| + } else { |
| + // Remove a resource to be handled by Service Worker from the cache to |
| + // prevent reuse because Service Worker can serve an arbitrary resource |
| + // for an URL and pollute a memory cache entry. |
| + // FIXME: isControlledByServiceWorker() always returns false on main |
| + // resource request, but main resource is always removed from the cache |
| + // as the above comment (http://crbug.com/388375). |
| + if (frame() && frame()->loader().client()->isControlledByServiceWorker()) { |
|
michaeln
2014/10/09 00:35:26
ouch, this is gonna hurt performance
nhiroki
2014/10/09 02:34:15
Yes, that's a sore point of this change. I'm going
dominicc (has gone to gerrit)
2014/10/09 02:45:24
Actually... why don't we land this as-is and concu
|
| + ASSERT(policy == Load || policy == Reload); |
| + memoryCache()->remove(resource.get()); |
| + } |
| } |
| requestLoadStarted(resource.get(), request, policy == Use ? ResourceLoadingFromCache : ResourceLoadingFromNetwork); |
| @@ -921,6 +932,11 @@ ResourceFetcher::RevalidationPolicy ResourceFetcher::determineRevalidationPolicy |
| if (!existingResource) |
| return Load; |
| + // FIXME: Currently caching for a resource to be handled by Service Worker |
| + // is disabled (http://crbug.com/388375). |
| + if (frame() && frame()->loader().client()->isControlledByServiceWorker()) |
| + return Reload; |
| + |
| // We already have a preload going for this URL. |
| if (fetchRequest.forPreload() && existingResource->isPreloaded()) |
| return Use; |