Auto merge of #27694 - ghostd:input-charset-case-insensitive, r=jdm

Make hidden input _charset_ check case insensitive

<!-- Please describe your changes on the following line: -->

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #27692

<!-- Either: -->
- [x] There are tests for these changes OR
- [ ] These changes do not require tests because ___

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
This commit is contained in:
bors-servo 2020-10-10 00:22:20 -04:00 committed by GitHub
commit b7475ae78f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 7 deletions

View file

@ -1328,7 +1328,7 @@ pub struct FormDatum {
impl FormDatum {
pub fn replace_value(&self, charset: &str) -> String {
if self.name == "_charset_" && self.ty == "hidden" {
if self.name.to_ascii_lowercase() == "_charset_" && self.ty == "hidden" {
return charset.to_string();
}
@ -1753,7 +1753,7 @@ pub fn encode_multipart_form_data(
// Step 3
for entry in form_data.iter_mut() {
// 3.1
if entry.name == "_charset_" && entry.ty == "hidden" {
if entry.name.to_ascii_lowercase() == "_charset_" && entry.ty == "hidden" {
entry.value = FormDatumValue::String(DOMString::from(charset.clone()));
}
// TODO: 3.2

View file

@ -1759,7 +1759,7 @@ impl HTMLInputElement {
// Step 5.10: it's a hidden field named _charset_
InputType::Hidden => {
if name == "_charset_" {
if name.to_ascii_lowercase() == "_charset_" {
return vec![FormDatum {
ty: ty.clone(),
name: name,

View file

@ -1,4 +0,0 @@
[hidden-charset-case-sensitive.html]
[keyword _charset_]
expected: FAIL