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 053130cf54544e5b845c97c05533782a5edb3f74..aa419f74f108582c1dc39db0e9dfad7fcfbe8033 100644 |
--- a/third_party/WebKit/Source/core/inspector/InspectorNetworkAgent.cpp |
+++ b/third_party/WebKit/Source/core/inspector/InspectorNetworkAgent.cpp |
@@ -140,8 +140,15 @@ 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) { |
+ // Ignores headers appended in prepareRequest(). |
+ if (header.key == |
+ HTTPNames::X_DevTools_Emulate_Network_Conditions_Client_Id || |
+ header.key == HTTPNames::X_DevTools_Request_Id) |
+ continue; |
+ |
headersObject->setString(header.key.getString(), header.value); |
+ } |
protocol::ErrorSupport errors; |
return protocol::Network::Headers::fromValue(headersObject.get(), &errors); |
} |
@@ -652,7 +659,7 @@ void InspectorNetworkAgent::willSendRequest( |
LocalFrame* frame, |
unsigned long identifier, |
DocumentLoader* loader, |
- ResourceRequest& request, |
+ const ResourceRequest& request, |
const ResourceResponse& redirectResponse, |
const FetchInitiatorInfo& initiatorInfo) { |
// Ignore the request initiated internally. |
@@ -663,6 +670,12 @@ void InspectorNetworkAgent::willSendRequest( |
loader->substituteData().isValid()) |
return; |
+ willSendRequestInternal(frame, identifier, loader, request, redirectResponse, |
+ initiatorInfo); |
+} |
+ |
+void InspectorNetworkAgent::prepareRequest(unsigned long identifier, |
+ ResourceRequest& request) { |
protocol::DictionaryValue* headers = |
m_state->getObject(NetworkAgentState::extraRequestHeaders); |
if (headers) { |
@@ -689,9 +702,6 @@ void InspectorNetworkAgent::willSendRequest( |
if (m_state->booleanProperty(NetworkAgentState::bypassServiceWorker, false)) |
request.setServiceWorkerMode(WebURLRequest::ServiceWorkerMode::None); |
- willSendRequestInternal(frame, identifier, loader, request, redirectResponse, |
- initiatorInfo); |
- |
if (!m_hostId.isEmpty()) |
request.addHTTPHeaderField( |
HTTPNames::X_DevTools_Emulate_Network_Conditions_Client_Id, |