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

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

Issue 2542073005: Sort headers for iteration (Closed)
Patch Set: Rebased Created 4 years 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
« no previous file with comments | « third_party/WebKit/Source/modules/fetch/FetchHeaderList.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/modules/fetch/Headers.cpp
diff --git a/third_party/WebKit/Source/modules/fetch/Headers.cpp b/third_party/WebKit/Source/modules/fetch/Headers.cpp
index c420ef8c5cebc6ad83206e6ce22dda35e9a7c39a..5511d78362a530590bb7b522bc1a3f9e8511b2ac 100644
--- a/third_party/WebKit/Source/modules/fetch/Headers.cpp
+++ b/third_party/WebKit/Source/modules/fetch/Headers.cpp
@@ -21,15 +21,18 @@ namespace {
class HeadersIterationSource final
: public PairIterable<String, String>::IterationSource {
public:
- explicit HeadersIterationSource(FetchHeaderList* headers)
- : m_headers(headers), m_current(0) {}
+ explicit HeadersIterationSource(const FetchHeaderList* headers)
+ : m_headers(headers->clone()), m_current(0) {
+ m_headers->sortAndCombine();
+ }
bool next(ScriptState* scriptState,
String& key,
String& value,
ExceptionState& exception) override {
- // FIXME: This simply advances an index and returns the next value if
- // any, so if the iterated object is mutated values may be skipped.
+ // This simply advances an index and returns the next value if any; the
+ // iterated list is not exposed to script so it will never be mutated
+ // during iteration.
if (m_current >= m_headers->size())
return false;
« no previous file with comments | « third_party/WebKit/Source/modules/fetch/FetchHeaderList.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698