Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(419)

Unified Diff: third_party/WebKit/Source/core/fetch/ResourceFetcher.cpp

Issue 2039893002: ResourceFetcher: fix an assertion failure on defered resource revalidation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: make asan happy Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/fetch/ResourceFetcherTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/fetch/ResourceFetcher.cpp
diff --git a/third_party/WebKit/Source/core/fetch/ResourceFetcher.cpp b/third_party/WebKit/Source/core/fetch/ResourceFetcher.cpp
index 2be06c9702689abd40bcb22dd54bd63264a9e820..6c2492b923fabc4ee15c98ead676777f266501dc 100644
--- a/third_party/WebKit/Source/core/fetch/ResourceFetcher.cpp
+++ b/third_party/WebKit/Source/core/fetch/ResourceFetcher.cpp
@@ -511,6 +511,10 @@ Resource* ResourceFetcher::requestResource(FetchRequest& request, const Resource
requestLoadStarted(resource, request, policy == Use ? ResourceLoadingFromCache : ResourceLoadingFromNetwork, isStaticData);
m_documentResources.set(urlWithoutFragment, resource);
+ // Returns with an existing resource if the resource does not need to start
+ // loading immediately.
+ // If revalidation policy was determined as |Revalidate|, the resource was
+ // already initialized for the revalidation here, but won't start loading.
if (!resourceNeedsLoad(resource, request, policy))
return resource;
@@ -795,8 +799,15 @@ ResourceFetcher::RevalidationPolicy ResourceFetcher::determineRevalidationPolicy
|| request.cacheControlContainsNoCache()) {
// See if the resource has usable ETag or Last-modified headers.
// If the page is controlled by the ServiceWorker, we choose the Reload policy because the revalidation headers should not be exposed to the ServiceWorker.(crbug.com/429570)
- if (existingResource->canUseCacheValidator() && !context().isControlledByServiceWorker())
+ if (existingResource->canUseCacheValidator() && !context().isControlledByServiceWorker()) {
+ // If the resource is already a cache validator but not started yet,
+ // the |Use| policy should be applied to subsequent requests.
+ if (existingResource->isCacheValidator()) {
+ DCHECK(existingResource->stillNeedsLoad());
+ return Use;
+ }
return Revalidate;
+ }
// No, must reload.
WTF_LOG(ResourceLoading, "ResourceFetcher::determineRevalidationPolicy reloading due to missing cache validators.");
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/fetch/ResourceFetcherTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698