New issue
Advanced search Search tips

Issue 845744 link

Starred by 2 users

Issue metadata

Status: Fixed
Owner:
Closed: May 2018
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 1
Type: Bug-Regression



Sign in to add a comment

USVString conversion doesn't work in |new FormData(form)|

Project Member Reported by tkent@chromium.org, May 23 2018

Issue description

Chrome Version: ToT later than r560505
OS: All

What steps will reproduce the problem?
(1) Open the following HTML:

<!DOCYPE html>
<form action="">
<input>
</form>
<script>
document.querySelector('input').name = 'n1\n2\uDC00';
document.querySelector('input').value = 'def\uDFFFghi';
var fd2 = new FormData(document.querySelector('form'));
var b5 = fd2.has('n1\n2\uFFFD');
alert('query: ' + b5)
</script>


What is the expected result?
It shows an alert dialog with 'query: true'

What happens instead?
It shows an alert dialog with 'query: false'



Please use labels and text to provide additional information.
It worked because FormData::Entry stored UTF8-encoded CString, and UTF8 encoder replaces U+DC00 with U+FFFD. Since r560505, we skip UTF8 encode.


 
Project Member

Comment 1 by bugdroid1@chromium.org, May 23 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/2faa3d9a446d56f044d6f4272202c1e026ef00e8

commit 2faa3d9a446d56f044d6f4272202c1e026ef00e8
Author: Kent Tamura <tkent@chromium.org>
Date: Wed May 23 04:06:36 2018

FormData: Strings from form controls should be converted to USVStrings

This CL fixes a regression by crrev.com/560505.

Before r560505 such strings were converted to USVStrings implicitly
because FromData::Entry stored encoded CStrings, and text encoders
replace unpaired surrogates with U+FFFD. Since r560505 we don't apply
text encoding in FormData::Entry, and need to convert strings to
USVStrings explicitly.

This CL also adds DCHECKs to FormData::Entry constructors.

Bug:  845744 
Change-Id: I9893848f4e32fbe3c0c7a8f787584fbbb8ba8e87
Reviewed-on: https://chromium-review.googlesource.com/1067560
Reviewed-by: Yoshifumi Inoue <yosin@chromium.org>
Commit-Queue: Kent Tamura <tkent@chromium.org>
Cr-Commit-Position: refs/heads/master@{#560929}
[modify] https://crrev.com/2faa3d9a446d56f044d6f4272202c1e026ef00e8/third_party/WebKit/LayoutTests/external/wpt/html/semantics/forms/form-submission-0/form-data-set-usv.html
[modify] https://crrev.com/2faa3d9a446d56f044d6f4272202c1e026ef00e8/third_party/blink/renderer/core/html/forms/form_data.cc
[modify] https://crrev.com/2faa3d9a446d56f044d6f4272202c1e026ef00e8/third_party/blink/renderer/core/html/forms/form_data.h

Comment 2 by tkent@chromium.org, May 23 2018

Status: Fixed (was: Started)

Sign in to add a comment