| Index: Source/core/fetch/Resource.cpp
|
| diff --git a/Source/core/fetch/Resource.cpp b/Source/core/fetch/Resource.cpp
|
| index 03711f8b7359aa6eed7948e66e85f5462a748184..fb9c614e77538a7ef09ea2bb1cf1bfe31ee8e430 100644
|
| --- a/Source/core/fetch/Resource.cpp
|
| +++ b/Source/core/fetch/Resource.cpp
|
| @@ -282,7 +282,7 @@ static double currentAge(const ResourceResponse& response, double responseTimest
|
| return correctedReceivedAge + residentTime;
|
| }
|
|
|
| -static double freshnessLifetime(const ResourceResponse& response, double responseTimestamp)
|
| +static double freshnessLifetime(ResourceResponse& response, double responseTimestamp)
|
| {
|
| #if !OS(ANDROID)
|
| // On desktop, local files should be reloaded in case they change.
|
| @@ -311,7 +311,7 @@ static double freshnessLifetime(const ResourceResponse& response, double respons
|
| return 0;
|
| }
|
|
|
| -static bool canUseResponse(const ResourceResponse& response, double responseTimestamp)
|
| +static bool canUseResponse(ResourceResponse& response, double responseTimestamp)
|
| {
|
| if (response.isNull())
|
| return false;
|
| @@ -493,7 +493,7 @@ void Resource::removeClient(ResourceClient* client)
|
| // "no-store: ... MUST make a best-effort attempt to remove the information from volatile storage as promptly as possible"
|
| // "... History buffers MAY store such responses as part of their normal operation."
|
| // We allow non-secure content to be reused in history, but we do not allow secure content to be reused.
|
| - if (response().cacheControlContainsNoStore() && url().protocolIs("https")) {
|
| + if (hasCacheControlNoStoreHeader() && url().protocolIs("https")) {
|
| memoryCache()->remove(this);
|
| memoryCache()->prune();
|
| } else {
|
| @@ -742,28 +742,35 @@ void Resource::unregisterHandle(ResourcePtrBase* h)
|
| }
|
| }
|
|
|
| -bool Resource::canReuseRedirectChain() const
|
| +bool Resource::canReuseRedirectChain()
|
| {
|
| for (size_t i = 0; i < m_redirectChain.size(); ++i) {
|
| if (!canUseResponse(m_redirectChain[i].m_redirectResponse, m_responseTimestamp))
|
| return false;
|
| + if (m_redirectChain[i].m_request.cacheControlContainsNoCache() || m_redirectChain[i].m_request.cacheControlContainsNoStore())
|
| + return false;
|
| }
|
| return true;
|
| }
|
|
|
| -bool Resource::mustRevalidateDueToCacheHeaders() const
|
| +bool Resource::hasCacheControlNoStoreHeader()
|
| +{
|
| + return m_response.cacheControlContainsNoStore() || m_resourceRequest.cacheControlContainsNoStore();
|
| +}
|
| +
|
| +bool Resource::mustRevalidateDueToCacheHeaders()
|
| {
|
| - return !canUseResponse(m_response, m_responseTimestamp);
|
| + return !canUseResponse(m_response, m_responseTimestamp) || m_resourceRequest.cacheControlContainsNoCache() || m_resourceRequest.cacheControlContainsNoStore();
|
| }
|
|
|
| -bool Resource::canUseCacheValidator() const
|
| +bool Resource::canUseCacheValidator()
|
| {
|
| if (m_loading || errorOccurred())
|
| return false;
|
|
|
| - if (m_response.cacheControlContainsNoStore())
|
| + if (hasCacheControlNoStoreHeader())
|
| return false;
|
| - return m_response.hasCacheValidatorFields();
|
| + return m_response.hasCacheValidatorFields() || m_resourceRequest.hasCacheValidatorFields();
|
| }
|
|
|
| bool Resource::isPurgeable() const
|
|
|