Index: src/WebRequestJsObject.cpp |
=================================================================== |
--- a/src/WebRequestJsObject.cpp |
+++ b/src/WebRequestJsObject.cpp |
@@ -36,20 +36,18 @@ namespace |
throw std::runtime_error("Invalid string passed as first argument to GET"); |
{ |
AdblockPlus::JsValuePtr headersObj = arguments[1]; |
if (!headersObj->IsObject()) |
throw std::runtime_error("Second argument to GET must be an object"); |
std::vector<std::string> properties = headersObj->GetOwnPropertyNames(); |
- for (std::vector<std::string>::iterator it = properties.begin(); |
- it != properties.end(); ++it) |
+ for (const auto& header : properties) |
{ |
- std::string header = *it; |
std::string headerValue = headersObj->GetProperty(header)->AsString(); |
if (header.length() && headerValue.length()) |
headers.push_back(std::pair<std::string, std::string>(header, headerValue)); |
} |
} |
callback = arguments[2]; |
if (!callback->IsFunction()) |
@@ -72,20 +70,19 @@ namespace |
AdblockPlus::JsContext context(jsEngine); |
AdblockPlus::JsValuePtr resultObject = jsEngine->NewObject(); |
resultObject->SetProperty("status", result.status); |
resultObject->SetProperty("responseStatus", result.responseStatus); |
resultObject->SetProperty("responseText", result.responseText); |
AdblockPlus::JsValuePtr headersObject = jsEngine->NewObject(); |
- for (AdblockPlus::HeaderList::iterator it = result.responseHeaders.begin(); |
- it != result.responseHeaders.end(); ++it) |
+ for (const auto& header : result.responseHeaders) |
{ |
- headersObject->SetProperty(it->first, it->second); |
+ headersObject->SetProperty(header.first, header.second); |
} |
resultObject->SetProperty("responseHeaders", headersObject); |
AdblockPlus::JsValueList params; |
params.push_back(resultObject); |
callback->Call(params); |
} |