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

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

Issue 1308183006: Move FormDataList::deleteEntry() and hasEntry() to DOMFormData. (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 | « Source/core/html/DOMFormData.h ('k') | 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 d797beced69bbb0b4de1ba4748764380716da382..7c25d6a06d35dca8f6687bbaf68e1a9861e235e1 100644
--- a/Source/core/html/DOMFormData.cpp
+++ b/Source/core/html/DOMFormData.cpp
@@ -120,6 +120,19 @@ void DOMFormData::append(ExecutionContext* context, const String& name, Blob* bl
appendBlob(name, blob, filename);
}
+void DOMFormData::deleteEntry(const String& name)
+{
+ const CString keyData = encodeAndNormalize(name);
+ size_t i = 0;
+ while (i < m_items.size()) {
+ if (m_items[i].key() == keyData) {
keishi 2015/09/09 04:18:16 nit: extra brackets
+ m_items.remove(i);
+ } else {
+ ++i;
+ }
+ }
+}
+
void DOMFormData::get(const String& name, FormDataEntryValue& result)
{
if (m_opaque)
@@ -160,7 +173,12 @@ bool DOMFormData::has(const String& name)
{
if (m_opaque)
return false;
- return hasEntry(name);
+ const CString keyData = encodeAndNormalize(name);
+ for (const Item& item : items()) {
+ if (item.key() == keyData)
+ return true;
+ }
+ return false;
}
void DOMFormData::set(const String& name, const String& value)
« no previous file with comments | « Source/core/html/DOMFormData.h ('k') | Source/core/html/DOMFormDataTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698