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

Side by Side Diff: third_party/WebKit/Source/core/html/HTMLFormElement.cpp

Issue 2416033002: Fixed the behaviour of form submit to match the standard: no submit is taken place when the form is… (Closed)
Patch Set: Added a test-case (submit cloned form) in third_party/WebKit/LayoutTests/fast/forms/submit-form-not… Created 4 years, 2 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 329 matching lines...) Expand 10 before | Expand all | Expand 10 after
340 } 340 }
341 } 341 }
342 342
343 void HTMLFormElement::submit(Event* event, 343 void HTMLFormElement::submit(Event* event,
344 HTMLFormControlElement* submitButton) { 344 HTMLFormControlElement* submitButton) {
345 FrameView* view = document().view(); 345 FrameView* view = document().view();
346 LocalFrame* frame = document().frame(); 346 LocalFrame* frame = document().frame();
347 if (!view || !frame || !frame->page()) 347 if (!view || !frame || !frame->page())
348 return; 348 return;
349 349
350 // See crbug.com/586749. 350 // https://html.spec.whatwg.org/multipage/forms.html#form-submission-algorithm
351 // 2. If form document is not connected, has no associated browsing context,
352 // or its active sandboxing flag set has its sandboxed forms browsing
353 // context flag set, then abort these steps without doing anything.
351 if (!isConnected()) 354 if (!isConnected())
352 UseCounter::count(document(), UseCounter::FormSubmissionNotInDocumentTree); 355 return;
tkent 2016/10/13 22:19:06 Let's show a console warning in order to notice wh
lunalu1 2016/10/14 15:08:45 Done.
353 356
354 if (m_isSubmitting) 357 if (m_isSubmitting)
355 return; 358 return;
356 359
357 // Delay dispatching 'close' to dialog until done submitting. 360 // Delay dispatching 'close' to dialog until done submitting.
358 EventQueueScope scopeForDialogClose; 361 EventQueueScope scopeForDialogClose;
359 AutoReset<bool> submitScope(&m_isSubmitting, true); 362 AutoReset<bool> submitScope(&m_isSubmitting, true);
360 363
361 if (event && !submitButton) { 364 if (event && !submitButton) {
362 // In a case of implicit submission without a submit button, 'submit' 365 // In a case of implicit submission without a submit button, 'submit'
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after
806 for (const auto& control : associatedElements()) { 809 for (const auto& control : associatedElements()) {
807 if (!control->isFormControlElement()) 810 if (!control->isFormControlElement())
808 continue; 811 continue;
809 if (toHTMLFormControlElement(control)->canBeSuccessfulSubmitButton()) 812 if (toHTMLFormControlElement(control)->canBeSuccessfulSubmitButton())
810 toHTMLFormControlElement(control)->pseudoStateChanged( 813 toHTMLFormControlElement(control)->pseudoStateChanged(
811 CSSSelector::PseudoDefault); 814 CSSSelector::PseudoDefault);
812 } 815 }
813 } 816 }
814 817
815 } // namespace blink 818 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/frame/UseCounter.h ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698