Bug 1463627 [wpt PR 11113] - FormData: Strings from form controls should be converted to USVStrings, a=testonly

Automatic update from web-platform-testsFormData: 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}

--

wpt-commits: 6df97f3630e83ec0caf1854b559c488368436a68
wpt-pr: 11113
This commit is contained in:
Kent Tamura 2018-05-31 19:14:53 +00:00 коммит произвёл James Graham
Родитель 1d89d30d52
Коммит 3a6b4f2ae2
2 изменённых файлов: 16 добавлений и 4 удалений

Просмотреть файл

@ -580344,7 +580344,7 @@
"support"
],
"html/semantics/forms/form-submission-0/form-data-set-usv.html": [
"6c089d542437cbd969ec76959344d9209c54f5ea",
"ae56e62c8b5ba0132d6270b478316fa8b6807b79",
"testharness"
],
"html/semantics/forms/form-submission-0/form-echo.py": [

Просмотреть файл

@ -8,12 +8,13 @@
<script src="/resources/testharnessreport.js"></script>
<iframe id="testframe" src="form-data-set-usv-form.html"></iframe>
<iframe id="testframe2" src="form-data-set-usv-form.html"></iframe>
<script>
"use strict";
async_test(t => {
window.onload = t.step_func(() => {
window.addEventListener("load", t.step_func(() => {
const iframe = document.querySelector("#testframe");
const form = iframe.contentWindow.document.querySelector("form");
@ -35,6 +36,17 @@ async_test(t => {
});
form.submit();
});
});
}));
}, 'Strings from form controls should be converted to Unicode scalar values in form submission');
async_test(t => {
window.addEventListener("load", t.step_func_done(() => {
const iframe = document.querySelector("#testframe2");
const formData = new FormData(iframe.contentWindow.document.querySelector("form"));
assert_equals(formData.get("input1\uFFFD"), "input1\uFFFD");
assert_equals(formData.get("input2\uFFFD"), "input2\uFFFD");
assert_equals(formData.get("input3\uFFFD"), "input3\uFFFD");
assert_equals(formData.get("input4\uFFFD"), "input4\uFFFD");
}));
}, 'Strings from form controls should be converted to Unicode scalar values in FormData');
</script>