Index: Source/core/inspector/InspectorResourceAgent.cpp |
diff --git a/Source/core/inspector/InspectorResourceAgent.cpp b/Source/core/inspector/InspectorResourceAgent.cpp |
index 1327d6326882386ca09268d7c8d4dececf1a1f10..09c759e33dd15325fbcf1c4678c0cd894a368663 100644 |
--- a/Source/core/inspector/InspectorResourceAgent.cpp |
+++ b/Source/core/inspector/InspectorResourceAgent.cpp |
@@ -94,9 +94,8 @@ const char kDevToolsEmulateNetworkConditionsClientId[] = "X-DevTools-Emulate-Net |
static PassRefPtr<JSONObject> buildObjectForHeaders(const HTTPHeaderMap& headers) |
{ |
RefPtr<JSONObject> headersObject = JSONObject::create(); |
- HTTPHeaderMap::const_iterator end = headers.end(); |
- for (HTTPHeaderMap::const_iterator it = headers.begin(); it != end; ++it) |
- headersObject->setString(it->key.string(), it->value); |
+ for (const auto& header : headers) |
+ headersObject->setString(header.key.string(), header.value); |
return headersObject; |
} |
@@ -423,11 +422,10 @@ void InspectorResourceAgent::willSendRequest(unsigned long identifier, DocumentL |
RefPtr<JSONObject> headers = m_state->getObject(ResourceAgentState::extraRequestHeaders); |
if (headers) { |
- JSONObject::const_iterator end = headers->end(); |
- for (JSONObject::const_iterator it = headers->begin(); it != end; ++it) { |
+ for (const auto& header : *headers) { |
String value; |
- if (it->value->asString(&value)) |
- request.setHTTPHeaderField(AtomicString(it->key), AtomicString(value)); |
+ if (header.value->asString(&value)) |
+ request.setHTTPHeaderField(AtomicString(header.key), AtomicString(value)); |
} |
} |
@@ -588,9 +586,8 @@ void InspectorResourceAgent::willLoadXHR(XMLHttpRequest* xhr, ThreadableLoaderCl |
{ |
ASSERT(xhr); |
RefPtrWillBeRawPtr<XHRReplayData> xhrReplayData = XHRReplayData::create(xhr->executionContext(), method, urlWithoutFragment(url), async, formData.get(), includeCredentials); |
- HTTPHeaderMap::const_iterator end = headers.end(); |
- for (HTTPHeaderMap::const_iterator it = headers.begin(); it!= end; ++it) |
- xhrReplayData->addHeader(it->key, it->value); |
+ for (const auto& header : headers) |
+ xhrReplayData->addHeader(header.key, header.value); |
m_pendingXHRReplayData.set(client, xhrReplayData); |
} |
@@ -631,9 +628,8 @@ void InspectorResourceAgent::willDestroyResource(Resource* cachedResource) |
bool base64Encoded; |
if (!InspectorPageAgent::cachedResourceContent(cachedResource, &content, &base64Encoded)) |
return; |
- Vector<String>::iterator end = requestIds.end(); |
- for (Vector<String>::iterator it = requestIds.begin(); it != end; ++it) |
- m_resourcesData->setResourceContent(*it, content, base64Encoded); |
+ for (auto& request : requestIds) |
+ m_resourcesData->setResourceContent(request, content, base64Encoded); |
} |
void InspectorResourceAgent::applyUserAgentOverride(String* userAgent) |
@@ -857,9 +853,8 @@ void InspectorResourceAgent::replayXHR(ErrorString*, const String& requestId) |
xhr->open(xhrReplayData->method(), xhrReplayData->url(), xhrReplayData->async(), IGNORE_EXCEPTION); |
if (xhrReplayData->includeCredentials()) |
xhr->setWithCredentials(true, IGNORE_EXCEPTION); |
- HTTPHeaderMap::const_iterator end = xhrReplayData->headers().end(); |
- for (HTTPHeaderMap::const_iterator it = xhrReplayData->headers().begin(); it!= end; ++it) |
- xhr->setRequestHeader(it->key, it->value, IGNORE_EXCEPTION); |
+ for (const auto& header : xhrReplayData->headers()) |
+ xhr->setRequestHeader(header.key, header.value, IGNORE_EXCEPTION); |
xhr->sendForInspectorXHRReplay(xhrReplayData->formData(), IGNORE_EXCEPTION); |
m_replayXHRs.add(xhr); |
@@ -908,14 +903,14 @@ void InspectorResourceAgent::loadResourceForFrontend(ErrorString* errorString, c |
request.setRequestContext(blink::WebURLRequest::RequestContextInternal); |
request.setCachePolicy(ReloadIgnoringCacheData); |
if (requestHeaders) { |
- for (JSONObject::iterator it = (*requestHeaders)->begin(); it != (*requestHeaders)->end(); ++it) { |
+ for (auto& header : *(*requestHeaders)) { |
String value; |
- bool success = it->value->asString(&value); |
+ bool success = header.value->asString(&value); |
if (!success) { |
- *errorString = "Request header \"" + it->key + "\" value is not a string"; |
+ *errorString = "Request header \"" + header.key + "\" value is not a string"; |
return; |
} |
- request.addHTTPHeaderField(AtomicString(it->key), AtomicString(value)); |
+ request.addHTTPHeaderField(AtomicString(header.key), AtomicString(value)); |
} |
} |
request.addHTTPHeaderField(kDevToolsRequestInitiator, "frontend"); |
@@ -975,11 +970,10 @@ bool InspectorResourceAgent::fetchResourceContent(Document* document, const KURL |
return true; |
// Then fall back to resource data. |
- Vector<NetworkResourcesData::ResourceData*> resources = m_resourcesData->resources(); |
- for (Vector<NetworkResourcesData::ResourceData*>::iterator it = resources.begin(); it != resources.end(); ++it) { |
- if ((*it)->url() == url) { |
- *content = (*it)->content(); |
- *base64Encoded = (*it)->base64Encoded(); |
+ for (auto& resource : m_resourcesData->resources()) { |
+ if (resource->url() == url) { |
+ *content = resource->content(); |
+ *base64Encoded = resource->base64Encoded(); |
return true; |
} |
} |