summaryrefslogtreecommitdiff
path: root/chromium/third_party/blink/renderer/core/html/forms/form_data.cc
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2021-10-26 13:57:00 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2021-11-02 11:31:01 +0000
commit1943b3c2a1dcee36c233724fc4ee7613d71b9cf6 (patch)
tree8c1b5f12357025c197da5427ae02cfdc2f3570d6 /chromium/third_party/blink/renderer/core/html/forms/form_data.cc
parent21ba0c5d4bf8fba15dddd97cd693bad2358b77fd (diff)
downloadqtwebengine-chromium-1943b3c2a1dcee36c233724fc4ee7613d71b9cf6.tar.gz
BASELINE: Update Chromium to 94.0.4606.111
Change-Id: I924781584def20fc800bedf6ff41fdb96c438193 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'chromium/third_party/blink/renderer/core/html/forms/form_data.cc')
-rw-r--r--chromium/third_party/blink/renderer/core/html/forms/form_data.cc55
1 files changed, 12 insertions, 43 deletions
diff --git a/chromium/third_party/blink/renderer/core/html/forms/form_data.cc b/chromium/third_party/blink/renderer/core/html/forms/form_data.cc
index b7f8ab79752..68bf88449fc 100644
--- a/chromium/third_party/blink/renderer/core/html/forms/form_data.cc
+++ b/chromium/third_party/blink/renderer/core/html/forms/form_data.cc
@@ -30,6 +30,7 @@
#include "third_party/blink/renderer/core/html/forms/form_data.h"
+#include "third_party/blink/renderer/bindings/core/v8/v8_binding_for_core.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_union_file_usvstring.h"
#include "third_party/blink/renderer/core/execution_context/execution_context.h"
#include "third_party/blink/renderer/core/fileapi/blob.h"
@@ -49,14 +50,15 @@ namespace blink {
namespace {
class FormDataIterationSource final
- : public PairIterable<String, FormDataEntryValue>::IterationSource {
+ : public PairIterable<String,
+ Member<V8FormDataEntryValue>>::IterationSource {
public:
FormDataIterationSource(FormData* form_data)
: form_data_(form_data), current_(0) {}
bool Next(ScriptState* script_state,
String& name,
- FormDataEntryValue& value,
+ Member<V8FormDataEntryValue>& value,
ExceptionState& exception_state) override {
if (current_ >= form_data_->size())
return false;
@@ -64,17 +66,18 @@ class FormDataIterationSource final
const FormData::Entry& entry = *form_data_->Entries()[current_++];
name = entry.name();
if (entry.IsString()) {
- value.SetUSVString(entry.Value());
+ value = MakeGarbageCollected<V8FormDataEntryValue>(entry.Value());
} else {
DCHECK(entry.isFile());
- value.SetFile(entry.GetFile());
+ value = MakeGarbageCollected<V8FormDataEntryValue>(entry.GetFile());
}
return true;
}
void Trace(Visitor* visitor) const override {
visitor->Trace(form_data_);
- PairIterable<String, FormDataEntryValue>::IterationSource::Trace(visitor);
+ PairIterable<String, Member<V8FormDataEntryValue>>::IterationSource::Trace(
+ visitor);
}
private:
@@ -143,7 +146,6 @@ void FormData::deleteEntry(const String& name) {
}
}
-#if defined(USE_BLINK_V8_BINDING_NEW_IDL_UNION)
V8FormDataEntryValue* FormData::get(const String& name) {
for (const auto& entry : Entries()) {
if (entry->name() == name) {
@@ -157,23 +159,7 @@ V8FormDataEntryValue* FormData::get(const String& name) {
}
return nullptr;
}
-#else // defined(USE_BLINK_V8_BINDING_NEW_IDL_UNION)
-void FormData::get(const String& name, FormDataEntryValue& result) {
- for (const auto& entry : Entries()) {
- if (entry->name() == name) {
- if (entry->IsString()) {
- result.SetUSVString(entry->Value());
- } else {
- DCHECK(entry->isFile());
- result.SetFile(entry->GetFile());
- }
- return;
- }
- }
-}
-#endif // defined(USE_BLINK_V8_BINDING_NEW_IDL_UNION)
-#if defined(USE_BLINK_V8_BINDING_NEW_IDL_UNION)
HeapVector<Member<V8FormDataEntryValue>> FormData::getAll(const String& name) {
HeapVector<Member<V8FormDataEntryValue>> results;
@@ -191,25 +177,6 @@ HeapVector<Member<V8FormDataEntryValue>> FormData::getAll(const String& name) {
}
return results;
}
-#else // defined(USE_BLINK_V8_BINDING_NEW_IDL_UNION)
-HeapVector<FormDataEntryValue> FormData::getAll(const String& name) {
- HeapVector<FormDataEntryValue> results;
-
- for (const auto& entry : Entries()) {
- if (entry->name() != name)
- continue;
- FormDataEntryValue value;
- if (entry->IsString()) {
- value.SetUSVString(entry->Value());
- } else {
- DCHECK(entry->isFile());
- value.SetFile(entry->GetFile());
- }
- results.push_back(value);
- }
- return results;
-}
-#endif // defined(USE_BLINK_V8_BINDING_NEW_IDL_UNION)
bool FormData::has(const String& name) {
for (const auto& entry : Entries()) {
@@ -346,7 +313,9 @@ scoped_refptr<EncodedFormData> FormData::EncodeMultiPartFormData() {
}
} else {
std::string encoded_value = Encode(entry->Value());
- form_data->AppendData(encoded_value.c_str(), encoded_value.length());
+ form_data->AppendData(
+ encoded_value.c_str(),
+ base::checked_cast<wtf_size_t>(encoded_value.length()));
}
form_data->AppendData("\r\n", 2);
}
@@ -356,7 +325,7 @@ scoped_refptr<EncodedFormData> FormData::EncodeMultiPartFormData() {
return form_data;
}
-PairIterable<String, FormDataEntryValue>::IterationSource*
+PairIterable<String, Member<V8FormDataEntryValue>>::IterationSource*
FormData::StartIteration(ScriptState*, ExceptionState&) {
return MakeGarbageCollected<FormDataIterationSource>(this);
}