mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Fix the webidl for Headers
Make the HeadersInit type match the spec. Fixes #26441
This commit is contained in:
parent
1a61937031
commit
c4273d86f2
6 changed files with 28 additions and 55 deletions
|
@ -198,20 +198,19 @@ impl HeadersMethods for Headers {
|
|||
}
|
||||
|
||||
impl Headers {
|
||||
pub fn copy_from_headers(&self, headers: DomRoot<Headers>) -> ErrorResult {
|
||||
for (name, value) in headers.header_list.borrow().iter() {
|
||||
self.Append(
|
||||
ByteString::new(Vec::from(name.as_str())),
|
||||
ByteString::new(Vec::from(value.as_bytes())),
|
||||
)?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
// https://fetch.spec.whatwg.org/#concept-headers-fill
|
||||
pub fn fill(&self, filler: Option<HeadersInit>) -> ErrorResult {
|
||||
match filler {
|
||||
// Step 1
|
||||
Some(HeadersInit::Headers(h)) => {
|
||||
for (name, value) in h.header_list.borrow().iter() {
|
||||
self.Append(
|
||||
ByteString::new(Vec::from(name.as_str())),
|
||||
ByteString::new(Vec::from(value.as_bytes())),
|
||||
)?;
|
||||
}
|
||||
Ok(())
|
||||
},
|
||||
// Step 2
|
||||
Some(HeadersInit::ByteStringSequenceSequence(v)) => {
|
||||
for mut seq in v {
|
||||
if seq.len() == 2 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue