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

Unified Diff: third_party/WebKit/Source/platform/loader/fetch/ResourceFetcher.cpp

Issue 2686533005: Remove type mismatch condition in requestResource (Closed)
Patch Set: Fix determineRevaliationPolicy Created 3 years, 10 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/platform/loader/fetch/ResourceFetcher.cpp
diff --git a/third_party/WebKit/Source/platform/loader/fetch/ResourceFetcher.cpp b/third_party/WebKit/Source/platform/loader/fetch/ResourceFetcher.cpp
index 043757333de76590275489104f18f2b95f0389cd..538830a9c898adb94eb8ba7f46b8af0a79a185d5 100644
--- a/third_party/WebKit/Source/platform/loader/fetch/ResourceFetcher.cpp
+++ b/third_party/WebKit/Source/platform/loader/fetch/ResourceFetcher.cpp
@@ -579,11 +579,9 @@ Resource* ResourceFetcher::requestResource(
}
if (!resource)
return nullptr;
- if (resource->getType() != factory.type()) {
- DCHECK(request.isSpeculativePreload() || request.isLinkPreload());
- // TODO(yoav): What's the scenario where this can actually happen?
- return nullptr;
- }
+
+ // TODO(yoav): turn to a DCHECK. See https://crbug.com/690632
+ CHECK_EQ(resource->getType(), factory.type());
if (!resource->isAlive())
m_deadStatsRecorder.update(policy);
@@ -827,10 +825,6 @@ ResourceFetcher::determineRevalidationPolicy(Resource::Type type,
if (existingResource->response().wasFallbackRequiredByServiceWorker())
return Reload;
- // We already have a preload going for this URL.
- if (fetchRequest.isSpeculativePreload() && existingResource->isPreloaded())
- return Use;
-
// If the same URL has been loaded as a different type, we need to reload.
if (existingResource->getType() != type) {
// FIXME: If existingResource is a Preload and the new type is LinkPrefetch
@@ -842,6 +836,10 @@ ResourceFetcher::determineRevalidationPolicy(Resource::Type type,
return Reload;
}
+ // We already have a preload going for this URL.
+ if (fetchRequest.isSpeculativePreload() && existingResource->isPreloaded())
+ return Use;
+
// Do not load from cache if images are not enabled. There are two general
// cases:
//
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698