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

Unified Diff: Source/core/inspector/InspectorResourceAgent.cpp

Issue 209343005: Move 'response' check in responseReceived() to the backend. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 9 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
« no previous file with comments | « no previous file | Source/devtools/front_end/NetworkManager.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/inspector/InspectorResourceAgent.cpp
diff --git a/Source/core/inspector/InspectorResourceAgent.cpp b/Source/core/inspector/InspectorResourceAgent.cpp
index 29accb85010442651df65dff82a0fe634ed6914b..1fad1886aa50f11abdd647f1649965d01276db7b 100644
--- a/Source/core/inspector/InspectorResourceAgent.cpp
+++ b/Source/core/inspector/InspectorResourceAgent.cpp
@@ -336,6 +336,18 @@ void InspectorResourceAgent::markResourceAsCached(unsigned long identifier)
m_frontend->requestServedFromCache(IdentifiersFactory::requestId(identifier));
}
+bool isResponseEmpty(PassRefPtr<TypeBuilder::Network::Response> response)
+{
+ if (!response)
+ return true;
+
+ RefPtr<JSONValue> status = response->get("status");
+ RefPtr<JSONValue> mimeType = response->get("mimeType");
+ RefPtr<JSONObject> headers = response->getObject("headers");
+
+ return !status && !mimeType && (!headers || !headers->size());
+}
+
void InspectorResourceAgent::didReceiveResourceResponse(LocalFrame* frame, unsigned long identifier, DocumentLoader* loader, const ResourceResponse& response, ResourceLoader* resourceLoader)
{
if (!loader)
@@ -369,7 +381,9 @@ void InspectorResourceAgent::didReceiveResourceResponse(LocalFrame* frame, unsig
m_resourcesData->responseReceived(requestId, m_pageAgent->frameId(loader->frame()), response);
m_resourcesData->setResourceType(requestId, type);
- m_frontend->responseReceived(requestId, m_pageAgent->frameId(loader->frame()), m_pageAgent->loaderId(loader), currentTime(), InspectorPageAgent::resourceTypeJson(type), resourceResponse);
+
+ if (!isResponseEmpty(resourceResponse))
+ m_frontend->responseReceived(requestId, m_pageAgent->frameId(loader->frame()), m_pageAgent->loaderId(loader), currentTime(), InspectorPageAgent::resourceTypeJson(type), resourceResponse);
// If we revalidated the resource and got Not modified, send content length following didReceiveResponse
// as there will be no calls to didReceiveData from the network stack.
if (isNotModified && cachedResource && cachedResource->encodedSize())
« no previous file with comments | « no previous file | Source/devtools/front_end/NetworkManager.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698