Chrome submits a submit button value even for form.submit()
Reported by
fanto...@gmail.com,
Sep 14 2016
|
|||||||
Issue descriptionUserAgent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:48.0) Gecko/20100101 Firefox/48.0 Steps to reproduce the problem: Issue https://bugs.chromium.org/p/chromium/issues/detail?id=378949 reproduces again on: Google Chrome 54.0.2840.16 beta-m (64-bit) Google Chrome 54.0.2840.8 dev-m (64-bit) Google Chrome Version 55.0.2860.0 canary (64-bit) What is the expected behavior? What went wrong? See https://bugs.chromium.org/p/chromium/issues/detail?id=378949 Did this work before? Yes 53.0.2785.113 m Chrome version: 55.0.2860.0 canary (64-bit)out:version'> Channel: canary OS Version: 6.1 (Windows 7, Windows Server 2008 R2) Flash Version:
,
Sep 15 2016
,
Sep 15 2016
minimum repro: <form onsubmit="this.submit(); return false;"> <input name="t" value="text"> <input type=submit name="b" value="Next"> </form> 1. Press [Next] Button 2. Observe the new URL Expected: ...?t=text Actual: ...?t=text&b=Next
,
Sep 15 2016
,
Sep 16 2016
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/864df709bb6b675152537a276723c2d0a8757e48 commit 864df709bb6b675152537a276723c2d0a8757e48 Author: tkent <tkent@chromium.org> Date: Fri Sep 16 01:39:31 2016 submit() in submit event handler should not contains a value of a submit button. The value of a submit button is appended to a FormData if its activatedSubmit flag is set. In a case of form.submit() is called in submit event handler, we did: 1. Set activatedSubmit flag of the submit button 2. Dispatch submit event 2.1. form.submit() builds FormData 3. Build FormData if the submit event was not prevented 4. Clear activatedSubmit flag of the submit button In step 2.1, we should not include the submit button. So, this CL changes the process as follows: 1. Dispatch submit event 1.1 form.submit() builds FormData 2. If the submit event was not prevented, 2.1. Set activatedSubmit flag of the submit button 2.2. Build FormData 2.3. Clear activatedSubmit flag of the submit button Implementation: We called setActivatedSubmit() before/after prepareForSubmission(). Instead, we pass a submit button element to prepareForSubmission(), and call setActivatedSubmit() just before/after building FormData. BUG= 646790 Review-Url: https://codereview.chromium.org/2340213002 Cr-Commit-Position: refs/heads/master@{#419073} [add] https://crrev.com/864df709bb6b675152537a276723c2d0a8757e48/third_party/WebKit/LayoutTests/fast/forms/form-submit-in-submit-event.html [modify] https://crrev.com/864df709bb6b675152537a276723c2d0a8757e48/third_party/WebKit/Source/core/html/HTMLButtonElement.cpp [modify] https://crrev.com/864df709bb6b675152537a276723c2d0a8757e48/third_party/WebKit/Source/core/html/HTMLFormElement.cpp [modify] https://crrev.com/864df709bb6b675152537a276723c2d0a8757e48/third_party/WebKit/Source/core/html/HTMLFormElement.h [modify] https://crrev.com/864df709bb6b675152537a276723c2d0a8757e48/third_party/WebKit/Source/core/html/forms/ImageInputType.cpp [modify] https://crrev.com/864df709bb6b675152537a276723c2d0a8757e48/third_party/WebKit/Source/core/html/forms/SubmitInputType.cpp [modify] https://crrev.com/864df709bb6b675152537a276723c2d0a8757e48/third_party/WebKit/Source/core/loader/FormSubmission.cpp [modify] https://crrev.com/864df709bb6b675152537a276723c2d0a8757e48/third_party/WebKit/Source/core/loader/FormSubmission.h
,
Sep 16 2016
,
Sep 16 2016
Your change meets the bar and is auto-approved for M54 (branch: 2840)
,
Sep 16 2016
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/f8be4fbd37d679e362c0eac49098fa913dc51ef3 commit f8be4fbd37d679e362c0eac49098fa913dc51ef3 Author: Kent Tamura <tkent@chromium.org> Date: Fri Sep 16 11:52:08 2016 Merge "submit() in submit event handler should not contains a value of a submit button." to M54 branch The value of a submit button is appended to a FormData if its activatedSubmit flag is set. In a case of form.submit() is called in submit event handler, we did: 1. Set activatedSubmit flag of the submit button 2. Dispatch submit event 2.1. form.submit() builds FormData 3. Build FormData if the submit event was not prevented 4. Clear activatedSubmit flag of the submit button In step 2.1, we should not include the submit button. So, this CL changes the process as follows: 1. Dispatch submit event 1.1 form.submit() builds FormData 2. If the submit event was not prevented, 2.1. Set activatedSubmit flag of the submit button 2.2. Build FormData 2.3. Clear activatedSubmit flag of the submit button Implementation: We called setActivatedSubmit() before/after prepareForSubmission(). Instead, we pass a submit button element to prepareForSubmission(), and call setActivatedSubmit() just before/after building FormData. BUG= 646790 Review-Url: https://codereview.chromium.org/2340213002 Cr-Commit-Position: refs/heads/master@{#419073} (cherry picked from commit 864df709bb6b675152537a276723c2d0a8757e48) Review URL: https://codereview.chromium.org/2342153003 . Cr-Commit-Position: refs/branch-heads/2840@{#388} Cr-Branched-From: 1ae106dbab4bddd85132d5b75c670794311f4c57-refs/heads/master@{#414607} [add] https://crrev.com/f8be4fbd37d679e362c0eac49098fa913dc51ef3/third_party/WebKit/LayoutTests/fast/forms/form-submit-in-submit-event.html [modify] https://crrev.com/f8be4fbd37d679e362c0eac49098fa913dc51ef3/third_party/WebKit/Source/core/html/HTMLButtonElement.cpp [modify] https://crrev.com/f8be4fbd37d679e362c0eac49098fa913dc51ef3/third_party/WebKit/Source/core/html/HTMLFormElement.cpp [modify] https://crrev.com/f8be4fbd37d679e362c0eac49098fa913dc51ef3/third_party/WebKit/Source/core/html/HTMLFormElement.h [modify] https://crrev.com/f8be4fbd37d679e362c0eac49098fa913dc51ef3/third_party/WebKit/Source/core/html/forms/ImageInputType.cpp [modify] https://crrev.com/f8be4fbd37d679e362c0eac49098fa913dc51ef3/third_party/WebKit/Source/core/html/forms/SubmitInputType.cpp [modify] https://crrev.com/f8be4fbd37d679e362c0eac49098fa913dc51ef3/third_party/WebKit/Source/core/loader/FormSubmission.cpp [modify] https://crrev.com/f8be4fbd37d679e362c0eac49098fa913dc51ef3/third_party/WebKit/Source/core/loader/FormSubmission.h
,
Sep 21 2016
Tested the issue on Win10, Mac OS X 10.11.6, Ubuntu 14.04 using Chrome Beta 54.0.2840.34. Followed the steps mentioned in c#3, it is working as expected. Adding TE-Verified labels. Attached screencast for reference. <form onsubmit="this.submit(); return false;"> <input name="t" value="text"> <input type=submit name="b" value="Next"> </form> 1. Press [Next] Button 2. Observe the new URL Actual: ...?t=text
,
Oct 27 2016
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/f8be4fbd37d679e362c0eac49098fa913dc51ef3 commit f8be4fbd37d679e362c0eac49098fa913dc51ef3 Author: Kent Tamura <tkent@chromium.org> Date: Fri Sep 16 11:52:08 2016 Merge "submit() in submit event handler should not contains a value of a submit button." to M54 branch The value of a submit button is appended to a FormData if its activatedSubmit flag is set. In a case of form.submit() is called in submit event handler, we did: 1. Set activatedSubmit flag of the submit button 2. Dispatch submit event 2.1. form.submit() builds FormData 3. Build FormData if the submit event was not prevented 4. Clear activatedSubmit flag of the submit button In step 2.1, we should not include the submit button. So, this CL changes the process as follows: 1. Dispatch submit event 1.1 form.submit() builds FormData 2. If the submit event was not prevented, 2.1. Set activatedSubmit flag of the submit button 2.2. Build FormData 2.3. Clear activatedSubmit flag of the submit button Implementation: We called setActivatedSubmit() before/after prepareForSubmission(). Instead, we pass a submit button element to prepareForSubmission(), and call setActivatedSubmit() just before/after building FormData. BUG= 646790 Review-Url: https://codereview.chromium.org/2340213002 Cr-Commit-Position: refs/heads/master@{#419073} (cherry picked from commit 864df709bb6b675152537a276723c2d0a8757e48) Review URL: https://codereview.chromium.org/2342153003 . Cr-Commit-Position: refs/branch-heads/2840@{#388} Cr-Branched-From: 1ae106dbab4bddd85132d5b75c670794311f4c57-refs/heads/master@{#414607} [add] https://crrev.com/f8be4fbd37d679e362c0eac49098fa913dc51ef3/third_party/WebKit/LayoutTests/fast/forms/form-submit-in-submit-event.html [modify] https://crrev.com/f8be4fbd37d679e362c0eac49098fa913dc51ef3/third_party/WebKit/Source/core/html/HTMLButtonElement.cpp [modify] https://crrev.com/f8be4fbd37d679e362c0eac49098fa913dc51ef3/third_party/WebKit/Source/core/html/HTMLFormElement.cpp [modify] https://crrev.com/f8be4fbd37d679e362c0eac49098fa913dc51ef3/third_party/WebKit/Source/core/html/HTMLFormElement.h [modify] https://crrev.com/f8be4fbd37d679e362c0eac49098fa913dc51ef3/third_party/WebKit/Source/core/html/forms/ImageInputType.cpp [modify] https://crrev.com/f8be4fbd37d679e362c0eac49098fa913dc51ef3/third_party/WebKit/Source/core/html/forms/SubmitInputType.cpp [modify] https://crrev.com/f8be4fbd37d679e362c0eac49098fa913dc51ef3/third_party/WebKit/Source/core/loader/FormSubmission.cpp [modify] https://crrev.com/f8be4fbd37d679e362c0eac49098fa913dc51ef3/third_party/WebKit/Source/core/loader/FormSubmission.h |
|||||||
►
Sign in to add a comment |
|||||||
Comment 1 by dtapu...@chromium.org
, Sep 14 2016Owner: tkent@chromium.org
Status: Assigned (was: Unconfirmed)