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

Unified Diff: third_party/WebKit/Source/platform/network/ParsedContentType.cpp

Issue 2736283002: Allow ParsedContentType to reject multiple definitions of the same parameter (Closed)
Patch Set: check first 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/platform/network/ParsedContentType.cpp
diff --git a/third_party/WebKit/Source/platform/network/ParsedContentType.cpp b/third_party/WebKit/Source/platform/network/ParsedContentType.cpp
index fb288e72b75104017e639190c2c67bc29534f4fc..8490b843d0a6742e7df0692e3888837996709706 100644
--- a/third_party/WebKit/Source/platform/network/ParsedContentType.cpp
+++ b/third_party/WebKit/Source/platform/network/ParsedContentType.cpp
@@ -264,11 +264,15 @@ bool ParsedContentType::parse(const String& contentType) {
<< ", for '" << key.toString() << "').";
return false;
}
- String keyString = key.toString();
// As |key| is parsed as a token, it consists of ascii characters
// and hence we don't need to care about non-ascii lowercasing.
- DCHECK(keyString.containsOnlyASCII());
- map.set(keyString.lower(), value);
+ DCHECK(key.toString().containsOnlyASCII());
+ String keyString = key.toString().lower();
+ if (m_mode == Mode::Strict && map.find(keyString) != map.end()) {
+ DVLOG(1) << "Parameter " << keyString << " is defined multiple times.";
+ return false;
+ }
+ map.set(keyString, value);
}
m_parameters = std::move(map);
return true;

Powered by Google App Engine
This is Rietveld 408576698