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 eb417151582a35a50c789d8d303499fcb4d47b1a..0fac19a6fbec58fd863755c1031bf1d3c2896c9d 100644 |
--- a/third_party/WebKit/Source/core/inspector/InspectorNetworkAgent.cpp |
+++ b/third_party/WebKit/Source/core/inspector/InspectorNetworkAgent.cpp |
@@ -119,8 +119,11 @@ bool matches(const String& url, const String& pattern) |
static std::unique_ptr<protocol::Network::Headers> buildObjectForHeaders(const HTTPHeaderMap& headers) |
{ |
std::unique_ptr<protocol::DictionaryValue> headersObject = protocol::DictionaryValue::create(); |
- for (const auto& header : headers) |
+ for (const auto& header : headers) { |
+ if (header.key == HTTPNames::X_DevTools_Emulate_Network_Conditions_Client_Id) |
+ continue; |
headersObject->setString(header.key.getString(), header.value); |
+ } |
protocol::ErrorSupport errors; |
return protocol::Network::Headers::parse(headersObject.get(), &errors); |
} |
@@ -484,7 +487,7 @@ bool InspectorNetworkAgent::shouldBlockRequest(const ResourceRequest& request) |
void InspectorNetworkAgent::didBlockRequest(LocalFrame* frame, const ResourceRequest& request, DocumentLoader* loader, const FetchInitiatorInfo& initiatorInfo, ResourceRequestBlockedReason reason) |
{ |
unsigned long identifier = createUniqueIdentifier(); |
- willSendRequestInternal(frame, identifier, loader, request, ResourceResponse(), initiatorInfo); |
+ willSendRequest(frame, identifier, loader, request, ResourceResponse(), initiatorInfo); |
String requestId = IdentifiersFactory::requestId(identifier); |
String protocolReason = buildBlockedReason(reason); |
@@ -497,8 +500,15 @@ void InspectorNetworkAgent::didChangeResourcePriority(unsigned long identifier, |
frontend()->resourceChangedPriority(requestId, resourcePriorityJSON(loadPriority), monotonicallyIncreasingTime()); |
} |
-void InspectorNetworkAgent::willSendRequestInternal(LocalFrame* frame, unsigned long identifier, DocumentLoader* loader, const ResourceRequest& request, const ResourceResponse& redirectResponse, const FetchInitiatorInfo& initiatorInfo) |
+void InspectorNetworkAgent::willSendRequest(LocalFrame* frame, unsigned long identifier, DocumentLoader* loader, const ResourceRequest& request, const ResourceResponse& redirectResponse, const FetchInitiatorInfo& initiatorInfo) |
{ |
+ // Ignore the request initiated internally. |
+ if (initiatorInfo.name == FetchInitiatorTypeNames::internal) |
+ return; |
+ |
+ if (initiatorInfo.name == FetchInitiatorTypeNames::document && loader->substituteData().isValid()) |
+ return; |
+ |
String requestId = IdentifiersFactory::requestId(identifier); |
String loaderId = IdentifiersFactory::loaderId(loader); |
m_resourcesData->resourceCreated(requestId, loaderId, request.url()); |
@@ -530,15 +540,8 @@ void InspectorNetworkAgent::willSendRequestInternal(LocalFrame* frame, unsigned |
frontend()->flush(); |
} |
-void InspectorNetworkAgent::willSendRequest(LocalFrame* frame, unsigned long identifier, DocumentLoader* loader, ResourceRequest& request, const ResourceResponse& redirectResponse, const FetchInitiatorInfo& initiatorInfo) |
+void InspectorNetworkAgent::prepareRequest(DocumentLoader* loader, ResourceRequest& request) |
{ |
- // Ignore the request initiated internally. |
- if (initiatorInfo.name == FetchInitiatorTypeNames::internal) |
- return; |
- |
- if (initiatorInfo.name == FetchInitiatorTypeNames::document && loader->substituteData().isValid()) |
- return; |
- |
protocol::DictionaryValue* headers = m_state->getObject(NetworkAgentState::extraRequestHeaders); |
if (headers) { |
for (size_t i = 0; i < headers->size(); ++i) { |
@@ -558,8 +561,6 @@ void InspectorNetworkAgent::willSendRequest(LocalFrame* frame, unsigned long ide |
if (m_state->booleanProperty(NetworkAgentState::bypassServiceWorker, false)) |
request.setSkipServiceWorker(WebURLRequest::SkipServiceWorker::All); |
- willSendRequestInternal(frame, identifier, loader, request, redirectResponse, initiatorInfo); |
- |
if (!m_hostId.isEmpty()) |
request.addHTTPHeaderField(HTTPNames::X_DevTools_Emulate_Network_Conditions_Client_Id, AtomicString(m_hostId)); |
} |