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

Unified Diff: Source/core/html/DOMFormData.cpp

Issue 1312333005: Remove FormDataList::Entry. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 3 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
« no previous file with comments | « no previous file | Source/core/html/DOMFormDataTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/DOMFormData.cpp
diff --git a/Source/core/html/DOMFormData.cpp b/Source/core/html/DOMFormData.cpp
index 8724bb963c6b768bc371f7c3a824da395788b30e..ad971ce01eb637aefd4b3babeaaf4ce99174a786 100644
--- a/Source/core/html/DOMFormData.cpp
+++ b/Source/core/html/DOMFormData.cpp
@@ -137,13 +137,18 @@ void DOMFormData::get(const String& name, FormDataEntryValue& result)
{
if (m_opaque)
return;
- Entry entry = getEntry(name);
- if (entry.isString())
- result.setUSVString(entry.string());
- else if (entry.isFile())
- result.setFile(entry.file());
- else
- ASSERT(entry.isNone());
+ const CString encodedName = encodeAndNormalize(name);
+ for (const Item& entry : items()) {
+ if (entry.key() == encodedName) {
+ if (entry.isString()) {
+ result.setUSVString(decode(entry.data()));
+ } else {
+ ASSERT(entry.isFile());
+ result.setFile(entry.file());
+ }
+ return;
+ }
+ }
}
HeapVector<FormDataEntryValue> DOMFormData::getAll(const String& name)
@@ -153,19 +158,19 @@ HeapVector<FormDataEntryValue> DOMFormData::getAll(const String& name)
if (m_opaque)
return results;
- HeapVector<FormDataList::Entry> entries = FormDataList::getAll(name);
- for (const FormDataList::Entry& entry : entries) {
- ASSERT(entry.name() == name);
+ const CString encodedName = encodeAndNormalize(name);
+ for (const Item& entry : items()) {
+ if (entry.key() != encodedName)
+ continue;
FormDataEntryValue value;
- if (entry.isString())
- value.setUSVString(entry.string());
- else if (entry.isFile())
+ if (entry.isString()) {
+ value.setUSVString(decode(entry.data()));
+ } else {
+ ASSERT(entry.isFile());
value.setFile(entry.file());
- else
- ASSERT_NOT_REACHED();
+ }
results.append(value);
}
- ASSERT(results.size() == entries.size());
return results;
}
« no previous file with comments | « no previous file | Source/core/html/DOMFormDataTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698