Skip to content

Commit

Permalink
Fix Request's Headers to be cloned correctly
Browse files Browse the repository at this point in the history
Previously, when `Clone()` was called, Headers of the template Request
did not get cloned properly. This commit fixes that issue, and updates
the expected wpt results.
  • Loading branch information
jeenalee committed Oct 12, 2016
1 parent f4cb87a commit d03167d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 11 deletions.
7 changes: 4 additions & 3 deletions components/script/dom/request.rs
Expand Up @@ -420,7 +420,7 @@ impl Request {
r
}

fn clone_from(r: &Request) -> Root<Request> {
fn clone_from(r: &Request) -> Fallible<Root<Request>> {
let req = r.request.borrow();
let url = req.url();
let is_service_worker_global_scope = req.is_service_worker_global_scope;
Expand All @@ -436,8 +436,9 @@ impl Request {
*r_clone.request.borrow_mut() = req.clone();
r_clone.body_used.set(body_used);
*r_clone.mime_type.borrow_mut() = mime_type;
try!(r_clone.Headers().fill(Some(HeadersInit::Headers(r.Headers()))));
r_clone.Headers().set_guard(headers_guard);
r_clone
Ok(r_clone)
}

pub fn get_request(&self) -> NetTraitsRequest {
Expand Down Expand Up @@ -613,7 +614,7 @@ impl RequestMethods for Request {
}

// Step 2
Ok(Request::clone_from(self))
Request::clone_from(self)
}

#[allow(unrooted_must_root)]
Expand Down

This file was deleted.

0 comments on commit d03167d

Please sign in to comment.