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

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

Issue 657873002: DevTools: Fix network log for Shared/Service workers (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 2 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 | no next file » | 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 830b242b448375ff75de83c862bbbc46693893c5..c079270d1449d97cf2358e4e5eb0b5893e6711f2 100644
--- a/Source/core/inspector/InspectorResourceAgent.cpp
+++ b/Source/core/inspector/InspectorResourceAgent.cpp
@@ -315,7 +315,8 @@ void InspectorResourceAgent::willSendRequest(unsigned long identifier, DocumentL
// Ignore the request initiated internally.
if (initiatorInfo.name == FetchInitiatorTypeNames::internal)
return;
- if (loader && loader->substituteData().isValid())
+
+ if (initiatorInfo.name == FetchInitiatorTypeNames::document && loader && loader->substituteData().isValid())
return;
String requestId = IdentifiersFactory::requestId(identifier);
@@ -373,9 +374,6 @@ bool isResponseEmpty(PassRefPtr<TypeBuilder::Network::Response> response)
void InspectorResourceAgent::didReceiveResourceResponse(LocalFrame* frame, unsigned long identifier, DocumentLoader* loader, const ResourceResponse& response, ResourceLoader* resourceLoader)
{
- if (loader && loader->substituteData().isValid())
- return;
-
String requestId = IdentifiersFactory::requestId(identifier);
RefPtr<TypeBuilder::Network::Response> resourceResponse = buildObjectForResourceResponse(response, loader);
@@ -387,11 +385,9 @@ void InspectorResourceAgent::didReceiveResourceResponse(LocalFrame* frame, unsig
if (!cachedResource || cachedResource->type() == Resource::MainResource)
cachedResource = InspectorPageAgent::cachedResource(frame, response.url());
- if (cachedResource) {
+ if (cachedResource && resourceResponse && response.mimeType().isEmpty()) {
// Use mime type from cached resource in case the one in response is empty.
- if (resourceResponse && response.mimeType().isEmpty())
- resourceResponse->setString(TypeBuilder::Network::Response::MimeType, cachedResource->response().mimeType());
- m_resourcesData->addResource(requestId, cachedResource);
+ resourceResponse->setString(TypeBuilder::Network::Response::MimeType, cachedResource->response().mimeType());
}
InspectorPageAgent::ResourceType type = cachedResource ? InspectorPageAgent::cachedResourceType(*cachedResource) : InspectorPageAgent::OtherResource;
@@ -402,9 +398,15 @@ void InspectorResourceAgent::didReceiveResourceResponse(LocalFrame* frame, unsig
if (loader && equalIgnoringFragmentIdentifier(response.url(), loader->url()) && !loader->isCommitted())
type = InspectorPageAgent::DocumentResource;
+ if (type == InspectorPageAgent::DocumentResource && loader && loader->substituteData().isValid())
+ return;
+
+ if (cachedResource)
+ m_resourcesData->addResource(requestId, cachedResource);
m_resourcesData->responseReceived(requestId, m_pageAgent->frameId(frame), response);
m_resourcesData->setResourceType(requestId, type);
+
if (!isResponseEmpty(resourceResponse))
m_frontend->responseReceived(requestId, m_pageAgent->frameId(frame), m_pageAgent->loaderId(loader), currentTime(), InspectorPageAgent::resourceTypeJson(type), resourceResponse);
// If we revalidated the resource and got Not modified, send content length following didReceiveResponse
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698