logo

WebKitGTK

Unnamed repository; edit this file 'description' to name the repository.
commit: 34dcc26d51708e018e09eacc697d3ab152f859ca
parent: 5f8fe474b6549cbe890586aaf447aa0590c39d20
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date:   Tue, 23 Jun 2020 07:48:58 +0200

Remove side-effect based on ETag and Last-Modified

Diffstat:

MSource/WebCore/loader/appcache/ApplicationCacheGroup.cpp9---------
MSource/WebCore/loader/cache/CachedResource.cpp11-----------
MSource/WebCore/platform/network/ResourceResponseBase.cpp2+-
MSource/WebKit/NetworkProcess/NetworkResourceLoader.cpp8--------
MSource/WebKit/NetworkProcess/ServiceWorker/ServiceWorkerSoftUpdateLoader.cpp8--------
MSource/WebKit/NetworkProcess/cache/AsyncRevalidation.cpp7-------
MSource/WebKit/NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp9---------
7 files changed, 1 insertion(+), 53 deletions(-)

diff --git a/Source/WebCore/loader/appcache/ApplicationCacheGroup.cpp b/Source/WebCore/loader/appcache/ApplicationCacheGroup.cpp @@ -466,15 +466,6 @@ ResourceRequest ApplicationCacheGroup::createRequest(URL&& url, ApplicationCache m_frame->loader().applyUserAgentIfNeeded(request); request.setHTTPHeaderField(HTTPHeaderName::CacheControl, HTTPHeaderValues::maxAge0()); - if (resource) { - const String& lastModified = resource->response().httpHeaderField(HTTPHeaderName::LastModified); - if (!lastModified.isEmpty()) - request.setHTTPHeaderField(HTTPHeaderName::IfModifiedSince, lastModified); - - const String& eTag = resource->response().httpHeaderField(HTTPHeaderName::ETag); - if (!eTag.isEmpty()) - request.setHTTPHeaderField(HTTPHeaderName::IfNoneMatch, eTag); - } return request; } diff --git a/Source/WebCore/loader/cache/CachedResource.cpp b/Source/WebCore/loader/cache/CachedResource.cpp @@ -258,17 +258,6 @@ void CachedResource::load(CachedResourceLoader& cachedResourceLoader) CachedResource* resourceToRevalidate = m_resourceToRevalidate; ASSERT(resourceToRevalidate->canUseCacheValidator()); ASSERT(resourceToRevalidate->isLoaded()); - const String& lastModified = resourceToRevalidate->response().httpHeaderField(HTTPHeaderName::LastModified); - const String& eTag = resourceToRevalidate->response().httpHeaderField(HTTPHeaderName::ETag); - if (!lastModified.isEmpty() || !eTag.isEmpty()) { - ASSERT(cachedResourceLoader.cachePolicy(type(), url()) != CachePolicyReload); - if (cachedResourceLoader.cachePolicy(type(), url()) == CachePolicyRevalidate) - m_resourceRequest.setHTTPHeaderField(HTTPHeaderName::CacheControl, HTTPHeaderValues::maxAge0()); - if (!lastModified.isEmpty()) - m_resourceRequest.setHTTPHeaderField(HTTPHeaderName::IfModifiedSince, lastModified); - if (!eTag.isEmpty()) - m_resourceRequest.setHTTPHeaderField(HTTPHeaderName::IfNoneMatch, eTag); - } } if (type() == Type::LinkPrefetch) diff --git a/Source/WebCore/platform/network/ResourceResponseBase.cpp b/Source/WebCore/platform/network/ResourceResponseBase.cpp @@ -648,7 +648,7 @@ bool ResourceResponseBase::hasCacheValidatorFields() const { lazyInit(CommonFieldsOnly); - return !m_httpHeaderFields.get(HTTPHeaderName::LastModified).isEmpty() || !m_httpHeaderFields.get(HTTPHeaderName::ETag).isEmpty(); + return false; } Optional<Seconds> ResourceResponseBase::cacheControlMaxAge() const diff --git a/Source/WebKit/NetworkProcess/NetworkResourceLoader.cpp b/Source/WebKit/NetworkProcess/NetworkResourceLoader.cpp @@ -1058,14 +1058,6 @@ void NetworkResourceLoader::validateCacheEntry(std::unique_ptr<NetworkCache::Ent // If the request is already conditional then the revalidation was not triggered by the disk cache // and we should not overwrite the existing conditional headers. ResourceRequest revalidationRequest = originalRequest(); - if (!revalidationRequest.isConditional()) { - String eTag = entry->response().httpHeaderField(HTTPHeaderName::ETag); - String lastModified = entry->response().httpHeaderField(HTTPHeaderName::LastModified); - if (!eTag.isEmpty()) - revalidationRequest.setHTTPHeaderField(HTTPHeaderName::IfNoneMatch, eTag); - if (!lastModified.isEmpty()) - revalidationRequest.setHTTPHeaderField(HTTPHeaderName::IfModifiedSince, lastModified); - } m_cacheEntryForValidation = WTFMove(entry); diff --git a/Source/WebKit/NetworkProcess/ServiceWorker/ServiceWorkerSoftUpdateLoader.cpp b/Source/WebKit/NetworkProcess/ServiceWorker/ServiceWorkerSoftUpdateLoader.cpp @@ -75,14 +75,6 @@ ServiceWorkerSoftUpdateLoader::ServiceWorkerSoftUpdateLoader(NetworkSession& ses request.setCachePolicy(ResourceRequestCachePolicy::RefreshAnyCacheData); if (entry) { m_cacheEntry = WTFMove(entry); - - String eTag = m_cacheEntry->response().httpHeaderField(HTTPHeaderName::ETag); - if (!eTag.isEmpty()) - request.setHTTPHeaderField(HTTPHeaderName::IfNoneMatch, eTag); - - String lastModified = m_cacheEntry->response().httpHeaderField(HTTPHeaderName::LastModified); - if (!lastModified.isEmpty()) - request.setHTTPHeaderField(HTTPHeaderName::IfModifiedSince, lastModified); } loadFromNetwork(*m_session, WTFMove(request)); }); diff --git a/Source/WebKit/NetworkProcess/cache/AsyncRevalidation.cpp b/Source/WebKit/NetworkProcess/cache/AsyncRevalidation.cpp @@ -41,13 +41,6 @@ static inline WebCore::ResourceRequest constructRevalidationRequest(const Key& k ASSERT_WITH_MESSAGE(key.range().isEmpty(), "range is not supported"); revalidationRequest.makeUnconditional(); - auto eTag = entry.response().httpHeaderField(WebCore::HTTPHeaderName::ETag); - if (!eTag.isEmpty()) - revalidationRequest.setHTTPHeaderField(WebCore::HTTPHeaderName::IfNoneMatch, eTag); - - auto lastModified = entry.response().httpHeaderField(WebCore::HTTPHeaderName::LastModified); - if (!lastModified.isEmpty()) - revalidationRequest.setHTTPHeaderField(WebCore::HTTPHeaderName::IfModifiedSince, lastModified); revalidationRequest.setPriority(WebCore::ResourceLoadPriority::Low); diff --git a/Source/WebKit/NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp b/Source/WebKit/NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp @@ -98,15 +98,6 @@ static inline ResourceRequest constructRevalidationRequest(const Key& key, const ASSERT_WITH_MESSAGE(key.range().isEmpty(), "range is not supported"); revalidationRequest.makeUnconditional(); - if (entry) { - String eTag = entry->response().httpHeaderField(HTTPHeaderName::ETag); - if (!eTag.isEmpty()) - revalidationRequest.setHTTPHeaderField(HTTPHeaderName::IfNoneMatch, eTag); - - String lastModified = entry->response().httpHeaderField(HTTPHeaderName::LastModified); - if (!lastModified.isEmpty()) - revalidationRequest.setHTTPHeaderField(HTTPHeaderName::IfModifiedSince, lastModified); - } revalidationRequest.setPriority(subResourceInfo.priority());