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

Side by Side 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights
6 * reserved. 6 * reserved.
7 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) 7 * (C) 2006 Alexey Proskuryakov (ap@nypop.com)
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 return false; 279 return false;
280 } 280 }
281 281
282 void HTMLFormElement::PrepareForSubmission( 282 void HTMLFormElement::PrepareForSubmission(
283 Event* event, 283 Event* event,
284 HTMLFormControlElement* submit_button) { 284 HTMLFormControlElement* submit_button) {
285 LocalFrame* frame = GetDocument().GetFrame(); 285 LocalFrame* frame = GetDocument().GetFrame();
286 if (!frame || is_submitting_ || in_user_js_submit_event_) 286 if (!frame || is_submitting_ || in_user_js_submit_event_)
287 return; 287 return;
288 288
289 if (!isConnected()) {
290 GetDocument().AddConsoleMessage(ConsoleMessage::Create(
291 kJSMessageSource, kWarningMessageLevel,
292 "Form submission canceled because the form is not connected"));
293 return;
294 }
295
289 if (GetDocument().IsSandboxed(kSandboxForms)) { 296 if (GetDocument().IsSandboxed(kSandboxForms)) {
290 GetDocument().AddConsoleMessage(ConsoleMessage::Create( 297 GetDocument().AddConsoleMessage(ConsoleMessage::Create(
291 kSecurityMessageSource, kErrorMessageLevel, 298 kSecurityMessageSource, kErrorMessageLevel,
292 "Blocked form submission to '" + attributes_.Action() + 299 "Blocked form submission to '" + attributes_.Action() +
293 "' because the form's frame is sandboxed and the 'allow-forms' " 300 "' because the form's frame is sandboxed and the 'allow-forms' "
294 "permission is not set.")); 301 "permission is not set."));
295 return; 302 return;
296 } 303 }
297 304
298 // https://github.com/whatwg/html/issues/2253 305 // https://github.com/whatwg/html/issues/2253
(...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after
842 for (const auto& control : ListedElements()) { 849 for (const auto& control : ListedElements()) {
843 if (!control->IsFormControlElement()) 850 if (!control->IsFormControlElement())
844 continue; 851 continue;
845 if (ToHTMLFormControlElement(control)->CanBeSuccessfulSubmitButton()) 852 if (ToHTMLFormControlElement(control)->CanBeSuccessfulSubmitButton())
846 ToHTMLFormControlElement(control)->PseudoStateChanged( 853 ToHTMLFormControlElement(control)->PseudoStateChanged(
847 CSSSelector::kPseudoDefault); 854 CSSSelector::kPseudoDefault);
848 } 855 }
849 } 856 }
850 857
851 } // namespace blink 858 } // namespace blink
OLDNEW
« 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