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

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

Issue 1987973002: Reload cache control: remove redundant header insertion from Blink Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: (just rebase to see bots' results again) 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
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 6c2492b923fabc4ee15c98ead676777f266501dc..439c01637ea4f5de9434c7215ba32022f04c4865 100644
--- a/third_party/WebKit/Source/core/fetch/ResourceFetcher.cpp
+++ b/third_party/WebKit/Source/core/fetch/ResourceFetcher.cpp
@@ -574,18 +574,8 @@ void ResourceFetcher::initializeRevalidation(const FetchRequest& request, Resour
revalidatingRequest.clearHTTPReferrer();
initializeResourceRequest(revalidatingRequest, resource->getType(), request.defer());
- const AtomicString& lastModified = resource->response().httpHeaderField(HTTPNames::Last_Modified);
- const AtomicString& eTag = resource->response().httpHeaderField(HTTPNames::ETag);
- if (!lastModified.isEmpty() || !eTag.isEmpty()) {
- ASSERT(context().getCachePolicy() != CachePolicyReload);
- if (context().getCachePolicy() == CachePolicyRevalidate)
- revalidatingRequest.setHTTPHeaderField(HTTPNames::Cache_Control, "max-age=0");
- }
- if (!lastModified.isEmpty())
- revalidatingRequest.setHTTPHeaderField(HTTPNames::If_Modified_Since, lastModified);
- if (!eTag.isEmpty())
- revalidatingRequest.setHTTPHeaderField(HTTPNames::If_None_Match, eTag);
-
+ // TODO(toyoshim): Figure out if following code is really needed and
+ // how this code works with Stale-While-Revalidate field trial.
double stalenessLifetime = resource->stalenessLifetime();
if (std::isfinite(stalenessLifetime) && stalenessLifetime > 0) {
revalidatingRequest.setHTTPHeaderField(HTTPNames::Resource_Freshness, AtomicString(String::format("max-age=%.0lf,stale-while-revalidate=%.0lf,age=%.0lf", resource->freshnessLifetime(), stalenessLifetime, resource->currentAge())));

Powered by Google App Engine
This is Rietveld 408576698