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

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

Issue 1323043002: Define "opaque" FormData objects. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Dropping makeOpaque again. Created 5 years, 4 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 ede76c078deb51d769ef12c8d284fe52b67e1c31..639d035deedc8abf133114999fb3dc7eabedd133 100644
--- a/Source/core/html/DOMFormData.cpp
+++ b/Source/core/html/DOMFormData.cpp
@@ -77,11 +77,13 @@ private:
DOMFormData::DOMFormData(const WTF::TextEncoding& encoding)
: FormDataList(encoding)
+ , m_opaque(false)
{
}
DOMFormData::DOMFormData(HTMLFormElement* form)
: FormDataList(UTF8Encoding())
+ , m_opaque(false)
{
if (!form)
return;
@@ -120,6 +122,8 @@ void DOMFormData::append(ExecutionContext* context, const String& name, Blob* bl
void DOMFormData::get(const String& name, FormDataEntryValue& result)
{
+ if (m_opaque)
+ return;
Entry entry = getEntry(name);
if (entry.isString())
result.setUSVString(entry.string());
@@ -132,6 +136,10 @@ void DOMFormData::get(const String& name, FormDataEntryValue& result)
HeapVector<FormDataEntryValue> DOMFormData::getAll(const String& name)
{
HeapVector<FormDataEntryValue> results;
+
+ if (m_opaque)
+ return results;
+
HeapVector<FormDataList::Entry> entries = FormDataList::getAll(name);
for (const FormDataList::Entry& entry : entries) {
ASSERT(entry.name() == name);
@@ -148,6 +156,13 @@ HeapVector<FormDataEntryValue> DOMFormData::getAll(const String& name)
return results;
}
+bool DOMFormData::has(const String& name)
+{
+ if (m_opaque)
+ return false;
+ return hasEntry(name);
+}
+
void DOMFormData::set(const String& name, const String& value)
{
setData(name, value);
@@ -160,6 +175,9 @@ void DOMFormData::set(const String& name, Blob* blob, const String& filename)
PairIterable<String, FormDataEntryValue>::IterationSource* DOMFormData::startIteration(ScriptState*, ExceptionState&)
{
+ if (m_opaque)
+ return new DOMFormDataIterationSource(new DOMFormData(nullptr));
+
return new DOMFormDataIterationSource(this);
}
« 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