diff options
author | Jeena Lee <ijeenalee@gmail.com> | 2016-10-12 12:46:03 -0700 |
---|---|---|
committer | Jeena Lee <ijeenalee@gmail.com> | 2016-10-12 12:49:02 -0700 |
commit | d03167d9801e6f082107899968a62b5af3be49fd (patch) | |
tree | 511bdf30abcfab1a0e054be2bd47ec725470f7ad /components/script/dom/request.rs | |
parent | f4cb87a783a85734021bdb14419de1350fbd255b (diff) | |
download | servo-d03167d9801e6f082107899968a62b5af3be49fd.tar.gz servo-d03167d9801e6f082107899968a62b5af3be49fd.zip |
Fix Request's Headers to be cloned correctly
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.
Diffstat (limited to 'components/script/dom/request.rs')
-rw-r--r-- | components/script/dom/request.rs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/components/script/dom/request.rs b/components/script/dom/request.rs index 4cad8753eeb..3358fc63ef5 100644 --- a/components/script/dom/request.rs +++ b/components/script/dom/request.rs @@ -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; @@ -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 { @@ -613,7 +614,7 @@ impl RequestMethods for Request { } // Step 2 - Ok(Request::clone_from(self)) + Request::clone_from(self) } #[allow(unrooted_must_root)] |