mirror of
https://github.com/servo/servo.git
synced 2025-08-05 05:30:08 +01:00
script: dont unwrap in header set (#32973)
Signed-off-by: tobinio <tobias.frischmann1@gmail.com>
This commit is contained in:
parent
b8cf0cf9af
commit
8fab6911d1
2 changed files with 32 additions and 6 deletions
|
@ -214,10 +214,20 @@ impl HeadersMethods for Headers {
|
||||||
}
|
}
|
||||||
// Step 7
|
// Step 7
|
||||||
// https://fetch.spec.whatwg.org/#concept-header-list-set
|
// https://fetch.spec.whatwg.org/#concept-header-list-set
|
||||||
self.header_list.borrow_mut().insert(
|
match HeaderValue::from_bytes(&valid_value) {
|
||||||
HeaderName::from_str(&valid_name).unwrap(),
|
Ok(value) => {
|
||||||
HeaderValue::from_bytes(&valid_value).unwrap(),
|
self.header_list
|
||||||
);
|
.borrow_mut()
|
||||||
|
.insert(HeaderName::from_str(&valid_name).unwrap(), value);
|
||||||
|
},
|
||||||
|
Err(_) => {
|
||||||
|
// can't add the header, but we don't need to panic the browser over it
|
||||||
|
warn!(
|
||||||
|
"Servo thinks \"{:?}\" is a valid HTTP header value but HeaderValue doesn't.",
|
||||||
|
valid_value
|
||||||
|
);
|
||||||
|
},
|
||||||
|
};
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,27 @@
|
||||||
[headers-normalize.any.worker.html]
|
[headers-normalize.any.worker.html]
|
||||||
expected: CRASH
|
[Create headers with not normalized values]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
[Check append method with not normalized values]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
[Check set method with not normalized values]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
|
||||||
[headers-normalize.any.sharedworker.html]
|
[headers-normalize.any.sharedworker.html]
|
||||||
expected: ERROR
|
expected: ERROR
|
||||||
|
|
||||||
[headers-normalize.any.html]
|
[headers-normalize.any.html]
|
||||||
expected: CRASH
|
[Create headers with not normalized values]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
[Check append method with not normalized values]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
[Check set method with not normalized values]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
|
||||||
[headers-normalize.any.serviceworker.html]
|
[headers-normalize.any.serviceworker.html]
|
||||||
expected: ERROR
|
expected: ERROR
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue