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

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: Align with review comments 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 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 kRenderingMessageSource, kErrorMessageLevel, message)); 276 kRenderingMessageSource, kErrorMessageLevel, message));
277 } 277 }
278 } 278 }
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 (submit_button && !submit_button->isConnected()))
tkent 2017/05/23 23:32:52 You don't need to check isConnected() of submit_bu
Shanmuga Pandi 2017/05/24 07:09:54 Done.
287 return; 288 return;
288 289
289 if (GetDocument().IsSandboxed(kSandboxForms)) { 290 if (GetDocument().IsSandboxed(kSandboxForms)) {
290 GetDocument().AddConsoleMessage(ConsoleMessage::Create( 291 GetDocument().AddConsoleMessage(ConsoleMessage::Create(
291 kSecurityMessageSource, kErrorMessageLevel, 292 kSecurityMessageSource, kErrorMessageLevel,
292 "Blocked form submission to '" + attributes_.Action() + 293 "Blocked form submission to '" + attributes_.Action() +
293 "' because the form's frame is sandboxed and the 'allow-forms' " 294 "' because the form's frame is sandboxed and the 'allow-forms' "
294 "permission is not set.")); 295 "permission is not set."));
295 return; 296 return;
296 } 297 }
(...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after
842 for (const auto& control : ListedElements()) { 843 for (const auto& control : ListedElements()) {
843 if (!control->IsFormControlElement()) 844 if (!control->IsFormControlElement())
844 continue; 845 continue;
845 if (ToHTMLFormControlElement(control)->CanBeSuccessfulSubmitButton()) 846 if (ToHTMLFormControlElement(control)->CanBeSuccessfulSubmitButton())
846 ToHTMLFormControlElement(control)->PseudoStateChanged( 847 ToHTMLFormControlElement(control)->PseudoStateChanged(
847 CSSSelector::kPseudoDefault); 848 CSSSelector::kPseudoDefault);
848 } 849 }
849 } 850 }
850 851
851 } // namespace blink 852 } // 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