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

Unified Diff: third_party/WebKit/Source/core/html/HTMLFormElement.cpp

Issue 2900943002: Clicking a button on disconnected form should not fire submit event. (Closed)
Patch Set: added console message Created 3 years, 7 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
Index: third_party/WebKit/Source/core/html/HTMLFormElement.cpp
diff --git a/third_party/WebKit/Source/core/html/HTMLFormElement.cpp b/third_party/WebKit/Source/core/html/HTMLFormElement.cpp
index c7383329660c994d10e0b8fe301908d6b9c3fec5..a5326a730d96102525617237f3f442fb3817d5db 100644
--- a/third_party/WebKit/Source/core/html/HTMLFormElement.cpp
+++ b/third_party/WebKit/Source/core/html/HTMLFormElement.cpp
@@ -286,6 +286,13 @@ void HTMLFormElement::PrepareForSubmission(
if (!frame || is_submitting_ || in_user_js_submit_event_)
return;
+ if (!isConnected()) {
+ GetDocument().AddConsoleMessage(ConsoleMessage::Create(
+ kJSMessageSource, kWarningMessageLevel,
+ "Form submission canceled because the form is not connected"));
+ return;
+ }
+
if (GetDocument().IsSandboxed(kSandboxForms)) {
GetDocument().AddConsoleMessage(ConsoleMessage::Create(
kSecurityMessageSource, kErrorMessageLevel,
« no previous file with comments | « third_party/WebKit/LayoutTests/external/wpt/html/semantics/forms/the-button-element/button-click-submits-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698