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

Unified Diff: third_party/WebKit/Source/modules/fetch/FetchHeaderList.h

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/FetchHeaderList.h
diff --git a/third_party/WebKit/Source/modules/fetch/FetchHeaderList.h b/third_party/WebKit/Source/modules/fetch/FetchHeaderList.h
index bfe552f483edeb89a46e88b229c023bc1febd9a4..90604231b6e3ed59d0794051d8bba46a02bcd994 100644
--- a/third_party/WebKit/Source/modules/fetch/FetchHeaderList.h
+++ b/third_party/WebKit/Source/modules/fetch/FetchHeaderList.h
@@ -5,13 +5,12 @@
#ifndef FetchHeaderList_h
#define FetchHeaderList_h
+#include <map>
+#include <utility>
#include "modules/ModulesExport.h"
#include "platform/heap/Handle.h"
-#include "wtf/PassRefPtr.h"
#include "wtf/Vector.h"
#include "wtf/text/WTFString.h"
-#include <memory>
-#include <utility>
namespace blink {
@@ -21,6 +20,12 @@ class Header;
class MODULES_EXPORT FetchHeaderList final
: public GarbageCollectedFinalized<FetchHeaderList> {
public:
+ struct ByteCaseInsensitiveCompare {
+ bool operator()(const String& lhs, const String& rhs) const {
+ return codePointCompareLessThan(lhs.upperASCII(), rhs.upperASCII());
+ }
+ };
+
typedef std::pair<String, String> Header;
static FetchHeaderList* create();
FetchHeaderList* clone() const;
@@ -39,11 +44,11 @@ class MODULES_EXPORT FetchHeaderList final
void clearList();
bool containsNonSimpleHeader() const;
- void sortAndCombine();
+ Vector<Header> sortAndCombine() const;
- const Vector<std::unique_ptr<Header>>& list() const { return m_headerList; }
- const Header& entry(size_t index) const {
- return *(m_headerList[index].get());
+ const std::multimap<String, String, ByteCaseInsensitiveCompare>& list()
+ const {
+ return m_headerList;
}
static bool isValidHeaderName(const String&);
@@ -53,7 +58,7 @@ class MODULES_EXPORT FetchHeaderList final
private:
FetchHeaderList();
- Vector<std::unique_ptr<Header>> m_headerList;
+ std::multimap<String, String, ByteCaseInsensitiveCompare> m_headerList;
};
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698