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

Unified Diff: third_party/WebKit/Source/modules/fetch/FetchResponseData.cpp

Issue 2787003002: Fetch API: Stop lowercasing header names. (Closed)
Patch Set: Fix failing tests Created 3 years, 9 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
Index: third_party/WebKit/Source/modules/fetch/FetchResponseData.cpp
diff --git a/third_party/WebKit/Source/modules/fetch/FetchResponseData.cpp b/third_party/WebKit/Source/modules/fetch/FetchResponseData.cpp
index 6509cae9ddff567538111d2e5515eae8d6da95d5..8880293a0189532c85c2ea922fff14822e4504c6 100644
--- a/third_party/WebKit/Source/modules/fetch/FetchResponseData.cpp
+++ b/third_party/WebKit/Source/modules/fetch/FetchResponseData.cpp
@@ -82,11 +82,10 @@ FetchResponseData* FetchResponseData::createBasicFilteredResponse() const {
FetchResponseData* response =
new FetchResponseData(BasicType, m_status, m_statusMessage);
response->setURLList(m_urlList);
- for (size_t i = 0; i < m_headerList->size(); ++i) {
- const FetchHeaderList::Header* header = m_headerList->list()[i].get();
- if (FetchUtils::isForbiddenResponseHeaderName(header->first))
+ for (const auto& header : m_headerList->list()) {
+ if (FetchUtils::isForbiddenResponseHeaderName(header.first))
continue;
- response->m_headerList->append(header->first, header->second);
+ response->m_headerList->append(header.first, header.second);
}
response->m_buffer = m_buffer;
response->m_mimeType = m_mimeType;
@@ -118,16 +117,15 @@ FetchResponseData* FetchResponseData::createCORSFilteredResponse(
FetchResponseData* response =
new FetchResponseData(CORSType, m_status, m_statusMessage);
response->setURLList(m_urlList);
- for (size_t i = 0; i < m_headerList->size(); ++i) {
- const FetchHeaderList::Header* header = m_headerList->list()[i].get();
- const String& name = header->first;
+ for (const auto& header : m_headerList->list()) {
+ const String& name = header.first;
const bool explicitlyExposed = exposedHeaders.contains(name);
if (isOnAccessControlResponseHeaderWhitelist(name) ||
(explicitlyExposed &&
!FetchUtils::isForbiddenResponseHeaderName(name))) {
if (explicitlyExposed)
response->m_corsExposedHeaderNames.insert(name);
- response->m_headerList->append(name, header->second);
+ response->m_headerList->append(name, header.second);
}
}
response->m_buffer = m_buffer;
@@ -270,9 +268,8 @@ void FetchResponseData::populateWebServiceWorkerResponse(
response.setCacheStorageCacheName(cacheStorageCacheName());
response.setCorsExposedHeaderNames(
headerSetToWebVector(m_corsExposedHeaderNames));
- for (size_t i = 0; i < headerList()->size(); ++i) {
- const FetchHeaderList::Header* header = headerList()->list()[i].get();
- response.appendHeader(header->first, header->second);
+ for (const auto& header : headerList()->list()) {
+ response.appendHeader(header.first, header.second);
}
}

Powered by Google App Engine
This is Rietveld 408576698