diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2016-11-17 15:34:47 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-11-17 15:34:47 -0600 |
commit | 22aebdf5d41a3509cd6515ccf5edcdf33715a76d (patch) | |
tree | 824af410d147404d0a6dc0908cec85cc71df5bfd /components/script/dom/response.rs | |
parent | b3ad71353bf264770bf0b3a87b32d86928eb09d4 (diff) | |
parent | 913c874cb55fd0fdc9e8f3a4c34624cd015fac8a (diff) | |
download | servo-22aebdf5d41a3509cd6515ccf5edcdf33715a76d.tar.gz servo-22aebdf5d41a3509cd6515ccf5edcdf33715a76d.zip |
Auto merge of #14246 - emilio:servo-url, r=SimonSapin
Urlmageddon
<!-- Please describe your changes on the following line: -->
Still needs a bunch of code in net to be converted in order to get more
advantage of this for images and stuff, but meanwhile this should help quite a
bit with #13778.
Still wanted to get this in.
r? @SimonSapin
<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/14246)
<!-- Reviewable:end -->
Diffstat (limited to 'components/script/dom/response.rs')
-rw-r--r-- | components/script/dom/response.rs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/components/script/dom/response.rs b/components/script/dom/response.rs index 7607cacc972..484a1d0beee 100644 --- a/components/script/dom/response.rs +++ b/components/script/dom/response.rs @@ -22,12 +22,12 @@ use hyper::header::Headers as HyperHeaders; use hyper::status::StatusCode; use hyper_serde::Serde; use net_traits::response::{ResponseBody as NetTraitsResponseBody}; +use servo_url::ServoUrl; use std::cell::Ref; use std::mem; use std::rc::Rc; use std::str::FromStr; use url::Position; -use url::Url; #[dom_struct] pub struct Response { @@ -40,8 +40,8 @@ pub struct Response { status: DOMRefCell<Option<StatusCode>>, raw_status: DOMRefCell<Option<(u16, Vec<u8>)>>, response_type: DOMRefCell<DOMResponseType>, - url: DOMRefCell<Option<Url>>, - url_list: DOMRefCell<Vec<Url>>, + url: DOMRefCell<Option<ServoUrl>>, + url_list: DOMRefCell<Vec<ServoUrl>>, // For now use the existing NetTraitsResponseBody enum body: DOMRefCell<NetTraitsResponseBody>, #[ignore_heap_size_of = "Rc"] @@ -156,7 +156,7 @@ impl Response { // Step 2 let url = match parsed_url { Ok(url) => url, - Err(_) => return Err(Error::Type("Url could not be parsed".to_string())), + Err(_) => return Err(Error::Type("ServoUrl could not be parsed".to_string())), }; // Step 3 @@ -357,8 +357,8 @@ impl ResponseMethods for Response { } } -fn serialize_without_fragment(url: &Url) -> &str { - &url[..Position::AfterQuery] +fn serialize_without_fragment(url: &ServoUrl) -> &str { + &url.as_url().unwrap()[..Position::AfterQuery] } impl Response { @@ -377,7 +377,7 @@ impl Response { *self.raw_status.borrow_mut() = status; } - pub fn set_final_url(&self, final_url: Url) { + pub fn set_final_url(&self, final_url: ServoUrl) { *self.url.borrow_mut() = Some(final_url); } |