diff options
author | Yutaro Ohno <yutaro.ono.418@gmail.com> | 2023-04-05 18:33:35 +0900 |
---|---|---|
committer | Yutaro Ohno <yutaro.ono.418@gmail.com> | 2023-04-05 20:02:31 +0900 |
commit | f0818aa383a19aaeac02293f940928eefc4c5835 (patch) | |
tree | 9d1a9707202f4a705f88576ef4999a3ebd505627 /components/script/dom | |
parent | a64a15ba5303aa52b21b6079ea8de430095e7caa (diff) | |
download | servo-f0818aa383a19aaeac02293f940928eefc4c5835.tar.gz servo-f0818aa383a19aaeac02293f940928eefc4c5835.zip |
Remove unnecessary steps from "text/plain encoding algorithm"
For "text/plain encoding algorithm", the specification [1] has changed
[2] and "_charset_" is not now handled here. It's supposed to be handled
in "construct the form data set" algorithm, and we've already
implemented that [3]. So we now have extra steps for "text/plain
encoding" algorithm.
Remove no longer necessary steps from text/plain encoding algorithm so
that it meets the specification.
[1]: https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#text/plain-encoding-algorithm
[2]: https://github.com/whatwg/html/pull/3645
[3]: https://github.com/servo/servo/pull/25217
Signed-off-by: Yutaro Ohno <yutaro.ono.418@gmail.com>
Diffstat (limited to 'components/script/dom')
-rw-r--r-- | components/script/dom/htmlformelement.rs | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/components/script/dom/htmlformelement.rs b/components/script/dom/htmlformelement.rs index 80adec9718a..82075eb884f 100644 --- a/components/script/dom/htmlformelement.rs +++ b/components/script/dom/htmlformelement.rs @@ -659,20 +659,15 @@ impl HTMLFormElement { let mut result = String::new(); // Step 2 - let encoding = self.pick_encoding(); - - // Step 3 - let charset = encoding.name(); - - for entry in form_data.iter_mut() { - // Step 4, 5 - let value = entry.replace_value(charset); - - // Step 6 - result.push_str(&*format!("{}={}\r\n", entry.name, value)); + for entry in form_data.iter() { + let value = match &entry.value { + FormDatumValue::File(f) => f.name(), + FormDatumValue::String(s) => s, + }; + result.push_str(&format!("{}={}\r\n", entry.name, value)); } - // Step 7 + // Step 3 result } |