logo

WebKitGTK

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

Remove support for 304 response side-effects

Diffstat:

MSource/WebCore/loader/SubresourceLoader.cpp13-------------
MSource/WebCore/loader/appcache/ApplicationCacheResourceLoader.cpp5-----
MSource/WebKit/NetworkProcess/NetworkResourceLoader.cpp18+-----------------
3 files changed, 1 insertion(+), 35 deletions(-)

diff --git a/Source/WebCore/loader/SubresourceLoader.cpp b/Source/WebCore/loader/SubresourceLoader.cpp @@ -379,19 +379,6 @@ void SubresourceLoader::didReceiveResponse(const ResourceResponse& response, Com response.includeCertificateInfo(); if (m_resource->resourceToRevalidate()) { - if (response.httpStatusCode() == 304) { - // 304 Not modified / Use local copy - // Existing resource is ok, just use it updating the expiration time. - ResourceResponse revalidationResponse = response; - revalidationResponse.setSource(ResourceResponse::Source::MemoryCacheAfterValidation); - m_resource->setResponse(revalidationResponse); - MemoryCache::singleton().revalidationSucceeded(*m_resource, revalidationResponse); - if (m_frame && m_frame->page()) - m_frame->page()->diagnosticLoggingClient().logDiagnosticMessageWithResult(DiagnosticLoggingKeys::cachedResourceRevalidationKey(), emptyString(), DiagnosticLoggingResultPass, ShouldSample::Yes); - if (!reachedTerminalState()) - ResourceLoader::didReceiveResponse(revalidationResponse, [completionHandlerCaller = WTFMove(completionHandlerCaller)] { }); - return; - } // Did not get 304 response, continue as a regular resource load. MemoryCache::singleton().revalidationFailed(*m_resource); if (m_frame && m_frame->page()) diff --git a/Source/WebCore/loader/appcache/ApplicationCacheResourceLoader.cpp b/Source/WebCore/loader/appcache/ApplicationCacheResourceLoader.cpp @@ -86,11 +86,6 @@ void ApplicationCacheResourceLoader::responseReceived(CachedResource& resource, return; } - if (response.httpStatusCode() == 304) { - notifyFinished(*m_resource); - return; - } - if (response.httpStatusCode() / 100 != 2) { cancel(Error::NotOK); return; diff --git a/Source/WebKit/NetworkProcess/NetworkResourceLoader.cpp b/Source/WebKit/NetworkProcess/NetworkResourceLoader.cpp @@ -508,15 +508,7 @@ void NetworkResourceLoader::didReceiveResponse(ResourceResponse&& receivedRespon m_bufferedDataForCache = nullptr; if (m_cacheEntryForValidation) { - bool validationSucceeded = m_response.httpStatusCode() == 304; // 304 Not Modified - RELEASE_LOG_IF_ALLOWED("didReceiveResponse: Received revalidation response (validationSucceeded=%d, wasOriginalRequestConditional=%d)", validationSucceeded, originalRequest().isConditional()); - if (validationSucceeded) { - m_cacheEntryForValidation = m_cache->update(originalRequest(), *m_cacheEntryForValidation, m_response); - // If the request was conditional then this revalidation was not triggered by the network cache and we pass the 304 response to WebCore. - if (originalRequest().isConditional()) - m_cacheEntryForValidation = nullptr; - } else - m_cacheEntryForValidation = nullptr; + m_cacheEntryForValidation = nullptr; } if (m_cacheEntryForValidation) return completionHandler(PolicyAction::Use); @@ -612,14 +604,6 @@ void NetworkResourceLoader::didFinishLoading(const NetworkLoadMetrics& networkLo if (shouldCaptureExtraNetworkLoadMetrics()) m_connection->addNetworkLoadInformationMetrics(identifier(), networkLoadMetrics); - if (m_cacheEntryForValidation) { - // 304 Not Modified - ASSERT(m_response.httpStatusCode() == 304); - LOG(NetworkCache, "(NetworkProcess) revalidated"); - didRetrieveCacheEntry(WTFMove(m_cacheEntryForValidation)); - return; - } - #if ENABLE(RESOURCE_LOAD_STATISTICS) && !RELEASE_LOG_DISABLED if (shouldLogCookieInformation(m_connection, sessionID())) logCookieInformation();