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

Unified Diff: third_party/WebKit/Source/core/loader/FormSubmission.cpp

Issue 2340213002: submit() in submit event handler should not contains a value of a submit button. (Closed)
Patch Set: Created 4 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 | « third_party/WebKit/Source/core/loader/FormSubmission.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/loader/FormSubmission.cpp
diff --git a/third_party/WebKit/Source/core/loader/FormSubmission.cpp b/third_party/WebKit/Source/core/loader/FormSubmission.cpp
index 3d26a2b8e3802c49e142abdd6fb9bdba9938d018..b438738db4e6d9142c1787630b68a3a7ce51fa31 100644
--- a/third_party/WebKit/Source/core/loader/FormSubmission.cpp
+++ b/third_party/WebKit/Source/core/loader/FormSubmission.cpp
@@ -162,20 +162,10 @@ inline FormSubmission::FormSubmission(const String& result)
{
}
-FormSubmission* FormSubmission::create(HTMLFormElement* form, const Attributes& attributes, Event* event)
+FormSubmission* FormSubmission::create(HTMLFormElement* form, const Attributes& attributes, Event* event, HTMLFormControlElement* submitButton)
{
DCHECK(form);
- HTMLFormControlElement* submitButton = 0;
- if (event && event->target()) {
- for (Node* node = event->target()->toNode(); node; node = node->parentOrShadowHostNode()) {
- if (node->isElementNode() && toElement(node)->isFormControlElement()) {
- submitButton = toHTMLFormControlElement(node);
- break;
- }
- }
- }
-
FormSubmission::Attributes copiedAttributes;
copiedAttributes.copyFrom(attributes);
if (submitButton) {
@@ -220,6 +210,8 @@ FormSubmission* FormSubmission::create(HTMLFormElement* form, const Attributes&
WTF::TextEncoding dataEncoding = isMailtoForm ? UTF8Encoding() : FormDataEncoder::encodingFromAcceptCharset(copiedAttributes.acceptCharset(), document.encoding());
FormData* domFormData = FormData::create(dataEncoding.encodingForFormSubmission());
+ if (submitButton)
+ submitButton->setActivatedSubmit(true);
bool containsPasswordData = false;
for (unsigned i = 0; i < form->associatedElements().size(); ++i) {
FormAssociatedElement* control = form->associatedElements()[i];
@@ -233,6 +225,8 @@ FormSubmission* FormSubmission::create(HTMLFormElement* form, const Attributes&
containsPasswordData = true;
}
}
+ if (submitButton)
+ submitButton->setActivatedSubmit(false);
RefPtr<EncodedFormData> formData;
String boundary;
« no previous file with comments | « third_party/WebKit/Source/core/loader/FormSubmission.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698