| Index: third_party/WebKit/Source/core/inspector/InspectorNetworkAgent.cpp
|
| diff --git a/third_party/WebKit/Source/core/inspector/InspectorNetworkAgent.cpp b/third_party/WebKit/Source/core/inspector/InspectorNetworkAgent.cpp
|
| index e648e34b6a7b53fb7aee9b34c829445579d42b10..b0e7fc4027266efe273dcbdb5ba7160efd74219a 100644
|
| --- a/third_party/WebKit/Source/core/inspector/InspectorNetworkAgent.cpp
|
| +++ b/third_party/WebKit/Source/core/inspector/InspectorNetworkAgent.cpp
|
| @@ -116,6 +116,21 @@ bool matches(const String& url, const String& pattern) {
|
| return true;
|
| }
|
|
|
| +bool LoadsFromCacheOnly(const ResourceRequest& request) {
|
| + switch (request.getCachePolicy()) {
|
| + case WebCachePolicy::UseProtocolCachePolicy:
|
| + case WebCachePolicy::ValidatingCacheData:
|
| + case WebCachePolicy::BypassingCache:
|
| + case WebCachePolicy::ReturnCacheDataElseLoad:
|
| + return false;
|
| + case WebCachePolicy::ReturnCacheDataDontLoad:
|
| + case WebCachePolicy::BypassCacheLoadOnlyFromCache:
|
| + return true;
|
| + }
|
| + NOTREACHED();
|
| + return false;
|
| +}
|
| +
|
| static std::unique_ptr<protocol::Network::Headers> buildObjectForHeaders(
|
| const HTTPHeaderMap& headers) {
|
| std::unique_ptr<protocol::DictionaryValue> headersObject =
|
| @@ -511,12 +526,6 @@ DEFINE_TRACE(InspectorNetworkAgent) {
|
| }
|
|
|
| bool InspectorNetworkAgent::shouldBlockRequest(const ResourceRequest& request) {
|
| - if (m_state->booleanProperty(NetworkAgentState::cacheDisabled, false) &&
|
| - request.requestContext() != WebURLRequest::RequestContextInternal &&
|
| - request.getCachePolicy() == WebCachePolicy::ReturnCacheDataDontLoad) {
|
| - return true;
|
| - }
|
| -
|
| protocol::DictionaryValue* blockedURLs =
|
| m_state->getObject(NetworkAgentState::blockedURLs);
|
| if (!blockedURLs)
|
| @@ -636,12 +645,12 @@ void InspectorNetworkAgent::willSendRequest(
|
| request.setReportRawHeaders(true);
|
|
|
| if (m_state->booleanProperty(NetworkAgentState::cacheDisabled, false)) {
|
| - // It shouldn't be a ReturnCacheDataDontLoad request as those are blocked
|
| - // in shouldBlockRequest unless it's from an internal source.
|
| - DCHECK(WebCachePolicy::ReturnCacheDataDontLoad !=
|
| - request.getCachePolicy() ||
|
| - request.requestContext() == WebURLRequest::RequestContextInternal);
|
| - request.setCachePolicy(WebCachePolicy::BypassingCache);
|
| + if (LoadsFromCacheOnly(request) &&
|
| + request.requestContext() != WebURLRequest::RequestContextInternal) {
|
| + request.setCachePolicy(WebCachePolicy::BypassCacheLoadOnlyFromCache);
|
| + } else {
|
| + request.setCachePolicy(WebCachePolicy::BypassingCache);
|
| + }
|
| request.setShouldResetAppCache(true);
|
| }
|
| if (m_state->booleanProperty(NetworkAgentState::bypassServiceWorker, false))
|
|
|