зеркало из https://github.com/mozilla/gecko-dev.git
servo: Merge #9840 - Update to rust-url 1.0 (from servo:url-1.0); r=asajeffrey
**Do not merge yet:** rust-url 1.0 is not published yet and may still get breaking changes. The goal of this PR for now is to demonstrate API usage. Depends on: * <s>https://github.com/servo/rust-url/pull/176</s> * <s>https://github.com/alexcrichton/cookie-rs/pull/42</s> * <s>https://github.com/hyperium/hyper/pull/740</s> * https://github.com/cyderize/rust-websocket/pull/70 * https://github.com/jgraham/webdriver-rust/pull/28 Source-Repo: https://github.com/servo/servo Source-Revision: 84ab7e9fe8f4a6528995eff3eb6e814cb724c364
This commit is contained in:
Родитель
f273a82175
Коммит
15f5299fe5
|
@ -97,4 +97,4 @@ rand = "0.3"
|
|||
serde = "0.7"
|
||||
serde_macros = "0.7"
|
||||
time = "0.1.17"
|
||||
url = {version = "0.5.7", features = ["heap_size"]}
|
||||
url = {version = "1.0.0", features = ["heap_size"]}
|
||||
|
|
|
@ -1932,7 +1932,7 @@ impl<LTF: LayoutThreadFactory, STF: ScriptThreadFactory> Constellation<LTF, STF>
|
|||
|
||||
let event_info = self.pipelines.get(&pipeline_id).and_then(|pipeline| {
|
||||
pipeline.parent_info.map(|(containing_pipeline_id, subpage_id)| {
|
||||
(containing_pipeline_id, subpage_id, pipeline.url.serialize())
|
||||
(containing_pipeline_id, subpage_id, pipeline.url.to_string())
|
||||
})
|
||||
});
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ path = "../plugins"
|
|||
git = "https://github.com/servo/ipc-channel"
|
||||
|
||||
[dependencies]
|
||||
hyper = { version = "0.8", features = [ "serde-serialization" ] }
|
||||
hyper = { version = "0.9", features = [ "serde-serialization" ] }
|
||||
serde = "0.7"
|
||||
serde_json = "0.7"
|
||||
serde_macros = "0.7"
|
||||
|
|
|
@ -312,7 +312,7 @@ impl NetworkEventActor {
|
|||
}
|
||||
|
||||
pub fn add_request(&mut self, request: DevtoolsHttpRequest) {
|
||||
self.request.url = request.url.serialize();
|
||||
self.request.url = request.url.as_str().to_owned();
|
||||
self.request.method = request.method.clone();
|
||||
self.request.headers = request.headers.clone();
|
||||
self.request.body = request.body;
|
||||
|
|
|
@ -285,7 +285,7 @@ fn run_server(sender: Sender<DevtoolsControlMsg>,
|
|||
let tab = TabActor {
|
||||
name: actors.new_name("tab"),
|
||||
title: String::from(title),
|
||||
url: url.serialize(),
|
||||
url: url.into_string(),
|
||||
console: console.name(),
|
||||
inspector: inspector.name(),
|
||||
timeline: timeline.name(),
|
||||
|
|
|
@ -20,10 +20,10 @@ path = "../plugins"
|
|||
[dependencies]
|
||||
heapsize = "0.3.0"
|
||||
heapsize_plugin = "0.1.2"
|
||||
hyper = { version = "0.8", features = [ "serde-serialization" ] }
|
||||
hyper = { version = "0.9", features = [ "serde-serialization" ] }
|
||||
time = "0.1"
|
||||
bitflags = "0.3"
|
||||
serde = "0.7"
|
||||
serde_macros = "0.7"
|
||||
url = {version = "0.5.7", features = ["heap_size"]}
|
||||
url = {version = "1.0.0", features = ["heap_size"]}
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ smallvec = "0.1"
|
|||
string_cache = {version = "0.2.12", features = ["heap_size"]}
|
||||
time = "0.1.12"
|
||||
unicode-script = { version = "0.1", features = ["harfbuzz"] }
|
||||
url = {version = "0.5.7", features = ["heap_size"]}
|
||||
url = {version = "1.0.0", features = ["heap_size"]}
|
||||
|
||||
[dependencies.plugins]
|
||||
path = "../plugins"
|
||||
|
|
|
@ -79,4 +79,4 @@ string_cache = {version = "0.2.12", features = ["heap_size"]}
|
|||
time = "0.1"
|
||||
unicode-bidi = "0.2"
|
||||
unicode-script = { version = "0.1", features = ["harfbuzz"] }
|
||||
url = {version = "0.5.7", features = ["heap_size"]}
|
||||
url = {version = "1.0.0", features = ["heap_size"]}
|
||||
|
|
|
@ -1002,7 +1002,7 @@ impl LayoutThread {
|
|||
let document = unsafe { ServoLayoutNode::new(&data.document) };
|
||||
let document = document.as_document().unwrap();
|
||||
|
||||
debug!("layout: received layout request for: {}", self.url.borrow().serialize());
|
||||
debug!("layout: received layout request for: {}", *self.url.borrow());
|
||||
|
||||
let mut rw_data = possibly_locked_rw_data.lock();
|
||||
|
||||
|
@ -1048,8 +1048,7 @@ impl LayoutThread {
|
|||
Some(x) => x,
|
||||
};
|
||||
|
||||
debug!("layout: received layout request for: {}",
|
||||
self.url.borrow().serialize());
|
||||
debug!("layout: received layout request for: {}", *self.url.borrow());
|
||||
if log_enabled!(log::LogLevel::Debug) {
|
||||
node.dump();
|
||||
}
|
||||
|
@ -1463,7 +1462,7 @@ impl LayoutThread {
|
|||
/// Returns profiling information which is passed to the time profiler.
|
||||
fn profiler_metadata(&self) -> Option<TimerMetadata> {
|
||||
Some(TimerMetadata {
|
||||
url: self.url.borrow().serialize(),
|
||||
url: self.url.borrow().to_string(),
|
||||
iframe: if self.is_iframe {
|
||||
TimerMetadataFrameType::IFrame
|
||||
} else {
|
||||
|
|
|
@ -35,4 +35,4 @@ git = "https://github.com/servo/webrender_traits"
|
|||
[dependencies]
|
||||
serde = "0.7"
|
||||
serde_macros = "0.7"
|
||||
url = {version = "0.5.7", features = ["heap_size"]}
|
||||
url = {version = "1.0.0", features = ["heap_size"]}
|
||||
|
|
|
@ -30,8 +30,8 @@ cssparser = {version = "0.5.4", features = ["heap_size", "serde-serialization"]}
|
|||
euclid = {version = "0.6.4", features = ["plugins"]}
|
||||
heapsize = "0.3.0"
|
||||
heapsize_plugin = "0.1.2"
|
||||
hyper = { version = "0.8", features = [ "serde-serialization" ] }
|
||||
hyper = { version = "0.9", features = [ "serde-serialization" ] }
|
||||
rustc-serialize = "0.3.4"
|
||||
serde = "0.7"
|
||||
serde_macros = "0.7"
|
||||
url = {version = "0.5.7", features = ["heap_size"]}
|
||||
url = {version = "1.0.0", features = ["heap_size"]}
|
||||
|
|
|
@ -35,9 +35,10 @@ git = "https://github.com/servo/webrender_traits"
|
|||
[dependencies]
|
||||
cookie = "0.2"
|
||||
flate2 = "0.2.0"
|
||||
hyper = { version = "0.8", features = [ "serde-serialization" ] }
|
||||
hyper = { version = "0.9", features = [ "serde-serialization" ] }
|
||||
immeta = "0.3.1"
|
||||
log = "0.3.5"
|
||||
matches = "0.1"
|
||||
mime = "0.2.0"
|
||||
mime_guess = "1.6.0"
|
||||
openssl = "0.7.6"
|
||||
|
@ -45,9 +46,9 @@ rustc-serialize = "0.3"
|
|||
threadpool = "1.0"
|
||||
time = "0.1.17"
|
||||
unicase = "1.4.0"
|
||||
url = {version = "0.5.7", features = ["heap_size"]}
|
||||
url = {version = "1.0.0", features = ["heap_size", "rustc-serialize"]}
|
||||
uuid = { version = "0.2", features = ["v4"] }
|
||||
websocket = "0.16.1"
|
||||
websocket = "0.17"
|
||||
|
||||
[target.'cfg(any(target_os = "macos", target_os = "linux"))'.dependencies]
|
||||
tinyfiledialogs = {git = "https://github.com/jdm/tinyfiledialogs"}
|
||||
|
|
|
@ -27,8 +27,7 @@ pub fn factory(mut load_data: LoadData,
|
|||
classifier: Arc<MIMEClassifier>,
|
||||
cancel_listener: CancellationListener) {
|
||||
let url = load_data.url.clone();
|
||||
let non_relative_scheme_data = url.non_relative_scheme_data().unwrap();
|
||||
match non_relative_scheme_data {
|
||||
match url.path() {
|
||||
"blank" => {
|
||||
let metadata = Metadata {
|
||||
final_url: load_data.url,
|
||||
|
@ -49,7 +48,7 @@ pub fn factory(mut load_data: LoadData,
|
|||
}
|
||||
"crash" => panic!("Loading the about:crash URL."),
|
||||
"failure" | "not-found" =>
|
||||
url_from_non_relative_scheme(&mut load_data, &(non_relative_scheme_data.to_owned() + ".html")),
|
||||
url_from_non_relative_scheme(&mut load_data, &(url.path().to_owned() + ".html")),
|
||||
"sslfail" => url_from_non_relative_scheme(&mut load_data, "badcert.html"),
|
||||
_ => {
|
||||
send_error(load_data.url, NetworkError::Internal("Unknown about: URL.".to_owned()), start_chan);
|
||||
|
|
|
@ -6,27 +6,33 @@ use file_loader;
|
|||
use mime_classifier::MIMEClassifier;
|
||||
use net_traits::{LoadConsumer, LoadData, NetworkError};
|
||||
use resource_thread::{CancellationListener, send_error};
|
||||
use std::path::Path;
|
||||
use std::fs::canonicalize;
|
||||
use std::sync::Arc;
|
||||
use url::Url;
|
||||
use url::percent_encoding::percent_decode;
|
||||
use util::resource_files::resources_dir_path;
|
||||
|
||||
pub fn resolve_chrome_url(url: &Url) -> Result<Url, ()> {
|
||||
assert_eq!(url.scheme, "chrome");
|
||||
// Skip the initial //
|
||||
let non_relative_scheme_data = &url.non_relative_scheme_data().unwrap()[2..];
|
||||
let relative_path = Path::new(non_relative_scheme_data);
|
||||
// Don't allow chrome URLs access to files outside of the resources directory.
|
||||
if non_relative_scheme_data.find("..").is_some() ||
|
||||
relative_path.is_absolute() ||
|
||||
relative_path.has_root() {
|
||||
return Err(());
|
||||
assert_eq!(url.scheme(), "chrome");
|
||||
if url.host_str() != Some("resources") {
|
||||
return Err(())
|
||||
}
|
||||
let resources = canonicalize(resources_dir_path())
|
||||
.expect("Error canonicalizing path to the resources directory");
|
||||
let mut path = resources.clone();
|
||||
for segment in url.path_segments().unwrap() {
|
||||
match percent_decode(segment.as_bytes()).decode_utf8() {
|
||||
// Check ".." to prevent access to files outside of the resources directory.
|
||||
Ok(segment) => path.push(&*segment),
|
||||
_ => return Err(())
|
||||
}
|
||||
}
|
||||
match canonicalize(path) {
|
||||
Ok(ref path) if path.starts_with(&resources) && path.exists() => {
|
||||
Ok(Url::from_file_path(path).unwrap())
|
||||
}
|
||||
_ => Err(())
|
||||
}
|
||||
|
||||
let mut path = resources_dir_path();
|
||||
path.push(non_relative_scheme_data);
|
||||
assert!(path.exists());
|
||||
return Ok(Url::from_file_path(&*path).unwrap());
|
||||
}
|
||||
|
||||
pub fn factory(mut load_data: LoadData,
|
||||
|
|
|
@ -40,7 +40,7 @@ impl Cookie {
|
|||
_ => (false, None)
|
||||
};
|
||||
|
||||
let url_host = request.host().map_or("".to_owned(), |host| host.serialize());
|
||||
let url_host = request.host_str().unwrap_or("").to_owned();
|
||||
|
||||
// Step 4
|
||||
let mut domain = cookie.domain.clone().unwrap_or("".to_owned());
|
||||
|
@ -68,9 +68,7 @@ impl Cookie {
|
|||
// Step 7
|
||||
let mut path = cookie.path.unwrap_or("".to_owned());
|
||||
if path.chars().next() != Some('/') {
|
||||
let url_path = request.serialize_path();
|
||||
let url_path = url_path.as_ref().map(|path| &**path);
|
||||
path = Cookie::default_path(url_path.unwrap_or("")).to_owned();
|
||||
path = Cookie::default_path(request.path()).to_owned();
|
||||
}
|
||||
cookie.path = Some(path);
|
||||
|
||||
|
@ -147,26 +145,26 @@ impl Cookie {
|
|||
|
||||
// http://tools.ietf.org/html/rfc6265#section-5.4 step 1
|
||||
pub fn appropriate_for_url(&self, url: &Url, source: CookieSource) -> bool {
|
||||
let domain = url.host().map(|host| host.serialize());
|
||||
let domain = url.host_str();
|
||||
if self.host_only {
|
||||
if self.cookie.domain != domain {
|
||||
if self.cookie.domain.as_ref().map(String::as_str) != domain {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
if let (Some(ref domain), &Some(ref cookie_domain)) = (domain, &self.cookie.domain) {
|
||||
if let (Some(domain), &Some(ref cookie_domain)) = (domain, &self.cookie.domain) {
|
||||
if !Cookie::domain_match(domain, cookie_domain) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if let (Some(ref path), &Some(ref cookie_path)) = (url.serialize_path(), &self.cookie.path) {
|
||||
if !Cookie::path_match(path, cookie_path) {
|
||||
if let Some(ref cookie_path) = self.cookie.path {
|
||||
if !Cookie::path_match(url.path(), cookie_path) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if self.cookie.secure && url.scheme != "https" {
|
||||
if self.cookie.secure && url.scheme() != "https" {
|
||||
return false;
|
||||
}
|
||||
if self.cookie.httponly && source == CookieSource::NonHTTP {
|
||||
|
|
|
@ -10,9 +10,8 @@ use net_traits::{LoadData, Metadata, NetworkError};
|
|||
use resource_thread::{CancellationListener, send_error, start_sending_sniffed_opt};
|
||||
use rustc_serialize::base64::FromBase64;
|
||||
use std::sync::Arc;
|
||||
use url::SchemeData;
|
||||
use url::Url;
|
||||
use url::percent_encoding::percent_decode;
|
||||
use url::{Position, Url};
|
||||
|
||||
pub fn factory(load_data: LoadData,
|
||||
senders: LoadConsumer,
|
||||
|
@ -33,58 +32,42 @@ pub enum DecodeError {
|
|||
pub type DecodeData = (Mime, Vec<u8>);
|
||||
|
||||
pub fn decode(url: &Url) -> Result<DecodeData, DecodeError> {
|
||||
assert!(&*url.scheme == "data");
|
||||
assert!(url.scheme() == "data");
|
||||
// Split out content type and data.
|
||||
let mut scheme_data = match url.scheme_data {
|
||||
SchemeData::NonRelative(ref scheme_data) => scheme_data.clone(),
|
||||
_ => panic!("Expected a non-relative scheme URL."),
|
||||
};
|
||||
match url.query {
|
||||
Some(ref query) => {
|
||||
scheme_data.push_str("?");
|
||||
scheme_data.push_str(query);
|
||||
},
|
||||
None => ()
|
||||
}
|
||||
let parts: Vec<&str> = scheme_data.splitn(2, ',').collect();
|
||||
let parts: Vec<&str> = url[Position::BeforePath..Position::AfterQuery].splitn(2, ',').collect();
|
||||
if parts.len() != 2 {
|
||||
return Err(DecodeError::InvalidDataUri);
|
||||
}
|
||||
|
||||
// ";base64" must come at the end of the content type, per RFC 2397.
|
||||
// rust-http will fail to parse it because there's no =value part.
|
||||
let mut is_base64 = false;
|
||||
let mut ct_str = parts[0].to_owned();
|
||||
if ct_str.ends_with(";base64") {
|
||||
is_base64 = true;
|
||||
let end_index = ct_str.len() - 7;
|
||||
ct_str.truncate(end_index);
|
||||
}
|
||||
if ct_str.starts_with(";charset=") {
|
||||
ct_str = format!("text/plain{}", ct_str);
|
||||
let mut ct_str = parts[0];
|
||||
let is_base64 = ct_str.ends_with(";base64");
|
||||
if is_base64 {
|
||||
ct_str = &ct_str[..ct_str.len() - ";base64".len()];
|
||||
}
|
||||
let ct_str = if ct_str.starts_with(";charset=") {
|
||||
format!("text/plain{}", ct_str)
|
||||
} else {
|
||||
ct_str.to_owned()
|
||||
};
|
||||
|
||||
// Parse the content type using rust-http.
|
||||
// FIXME: this can go into an infinite loop! (rust-http #25)
|
||||
let mut content_type: Option<Mime> = ct_str.parse().ok();
|
||||
if content_type == None {
|
||||
content_type = Some(Mime(TopLevel::Text, SubLevel::Plain,
|
||||
vec!((Attr::Charset, Value::Ext("US-ASCII".to_owned())))));
|
||||
}
|
||||
let content_type = ct_str.parse().unwrap_or_else(|_| {
|
||||
Mime(TopLevel::Text, SubLevel::Plain,
|
||||
vec![(Attr::Charset, Value::Ext("US-ASCII".to_owned()))])
|
||||
});
|
||||
|
||||
let bytes = percent_decode(parts[1].as_bytes());
|
||||
let bytes = if is_base64 {
|
||||
let mut bytes = percent_decode(parts[1].as_bytes()).collect::<Vec<_>>();
|
||||
if is_base64 {
|
||||
// FIXME(#2909): It’s unclear what to do with non-alphabet characters,
|
||||
// but Acid 3 apparently depends on spaces being ignored.
|
||||
let bytes = bytes.into_iter().filter(|&b| b != ' ' as u8).collect::<Vec<u8>>();
|
||||
bytes = bytes.into_iter().filter(|&b| b != ' ' as u8).collect::<Vec<u8>>();
|
||||
match bytes.from_base64() {
|
||||
Err(..) => return Err(DecodeError::NonBase64DataUri),
|
||||
Ok(data) => data,
|
||||
Ok(data) => bytes = data,
|
||||
}
|
||||
} else {
|
||||
bytes
|
||||
};
|
||||
Ok((content_type.unwrap(), bytes))
|
||||
}
|
||||
Ok((content_type, bytes))
|
||||
}
|
||||
|
||||
pub fn load(load_data: LoadData,
|
||||
|
|
|
@ -26,8 +26,7 @@ use std::iter::FromIterator;
|
|||
use std::rc::Rc;
|
||||
use std::thread;
|
||||
use unicase::UniCase;
|
||||
use url::idna::domain_to_ascii;
|
||||
use url::{Origin as UrlOrigin, OpaqueOrigin, Url, UrlParser, whatwg_scheme_type_mapper};
|
||||
use url::{Origin as UrlOrigin, Url};
|
||||
use util::thread::spawn_named;
|
||||
|
||||
pub fn fetch_async(request: Request, listener: Box<AsyncFetchListener + Send>) {
|
||||
|
@ -115,7 +114,7 @@ fn main_fetch(request: Rc<Request>, cors_flag: bool, recursive_flag: bool) -> Re
|
|||
|
||||
// Step 2
|
||||
if request.local_urls_only {
|
||||
match &*request.current_url().scheme {
|
||||
match request.current_url().scheme() {
|
||||
"about" | "blob" | "data" | "filesystem" => (), // Ok, the URL is local.
|
||||
_ => response = Some(Response::network_error())
|
||||
}
|
||||
|
@ -153,8 +152,8 @@ fn main_fetch(request: Rc<Request>, cors_flag: bool, recursive_flag: bool) -> Re
|
|||
};
|
||||
|
||||
if (same_origin && !cors_flag ) ||
|
||||
(current_url.scheme == "data" && request.same_origin_data.get()) ||
|
||||
current_url.scheme == "about" ||
|
||||
(current_url.scheme() == "data" && request.same_origin_data.get()) ||
|
||||
current_url.scheme() == "about" ||
|
||||
request.mode == RequestMode::Navigate {
|
||||
|
||||
basic_fetch(request.clone())
|
||||
|
@ -166,7 +165,7 @@ fn main_fetch(request: Rc<Request>, cors_flag: bool, recursive_flag: bool) -> Re
|
|||
request.response_tainting.set(ResponseTainting::Opaque);
|
||||
basic_fetch(request.clone())
|
||||
|
||||
} else if current_url.scheme != "http" && current_url.scheme != "https" {
|
||||
} else if !matches!(current_url.scheme(), "http" | "https") {
|
||||
Response::network_error()
|
||||
|
||||
} else if request.use_cors_preflight ||
|
||||
|
@ -253,10 +252,7 @@ fn main_fetch(request: Rc<Request>, cors_flag: bool, recursive_flag: bool) -> Re
|
|||
}
|
||||
|
||||
// Step 17
|
||||
if request.body.borrow().is_some() && match &*request.current_url().scheme {
|
||||
"http" | "https" => true,
|
||||
_ => false }
|
||||
{
|
||||
if request.body.borrow().is_some() && matches!(request.current_url().scheme(), "http" | "https") {
|
||||
// TODO queue a fetch task on request to process end-of-file
|
||||
}
|
||||
|
||||
|
@ -287,20 +283,14 @@ fn main_fetch(request: Rc<Request>, cors_flag: bool, recursive_flag: bool) -> Re
|
|||
fn basic_fetch(request: Rc<Request>) -> Response {
|
||||
|
||||
let url = request.current_url();
|
||||
let scheme = url.scheme.clone();
|
||||
|
||||
match &*scheme {
|
||||
match url.scheme() {
|
||||
|
||||
"about" => {
|
||||
match url.non_relative_scheme_data() {
|
||||
Some(s) if &*s == "blank" => {
|
||||
let mut response = Response::new();
|
||||
response.headers.set(ContentType(mime!(Text / Html; Charset = Utf8)));
|
||||
*response.body.lock().unwrap() = ResponseBody::Done(vec![]);
|
||||
response
|
||||
},
|
||||
_ => Response::network_error()
|
||||
}
|
||||
"about" if url.path() == "blank" => {
|
||||
let mut response = Response::new();
|
||||
response.headers.set(ContentType(mime!(Text / Html; Charset = Utf8)));
|
||||
*response.body.lock().unwrap() = ResponseBody::Done(vec![]);
|
||||
response
|
||||
},
|
||||
|
||||
"http" | "https" => {
|
||||
|
@ -535,7 +525,7 @@ fn http_redirect_fetch(request: Rc<Request>,
|
|||
|
||||
// Step 5
|
||||
let response_url = response.actual_response().url.as_ref().unwrap();
|
||||
let location_url = UrlParser::new().base_url(response_url).parse(&*location);
|
||||
let location_url = response_url.join(&*location);
|
||||
|
||||
// Step 6
|
||||
let location_url = match location_url {
|
||||
|
@ -573,7 +563,7 @@ fn http_redirect_fetch(request: Rc<Request>,
|
|||
|
||||
// Step 12
|
||||
if cors_flag && !same_origin {
|
||||
*request.origin.borrow_mut() = Origin::Origin(UrlOrigin::UID(OpaqueOrigin::new()));
|
||||
*request.origin.borrow_mut() = Origin::Origin(UrlOrigin::new_opaque());
|
||||
}
|
||||
|
||||
// Step 13
|
||||
|
@ -632,7 +622,7 @@ fn http_network_or_cache_fetch(request: Rc<Request>,
|
|||
Referer::NoReferer =>
|
||||
http_request.headers.borrow_mut().set(RefererHeader("".to_owned())),
|
||||
Referer::RefererUrl(ref http_request_referer) =>
|
||||
http_request.headers.borrow_mut().set(RefererHeader(http_request_referer.serialize())),
|
||||
http_request.headers.borrow_mut().set(RefererHeader(http_request_referer.to_string())),
|
||||
Referer::Client =>
|
||||
// it should be impossible for referer to be anything else during fetching
|
||||
// https://fetch.spec.whatwg.org/#concept-request-referrer
|
||||
|
@ -702,9 +692,9 @@ fn http_network_or_cache_fetch(request: Rc<Request>,
|
|||
|
||||
let current_url = http_request.current_url();
|
||||
|
||||
authorization_value = if includes_credentials(¤t_url) {
|
||||
authorization_value = if has_credentials(¤t_url) {
|
||||
Some(Basic {
|
||||
username: current_url.username().unwrap_or("").to_owned(),
|
||||
username: current_url.username().to_owned(),
|
||||
password: current_url.password().map(str::to_owned)
|
||||
})
|
||||
} else {
|
||||
|
@ -1059,13 +1049,8 @@ fn cors_check(request: Rc<Request>, response: &Response) -> Result<(), ()> {
|
|||
_ => return Err(())
|
||||
};
|
||||
|
||||
// strings are already utf-8 encoded, so there's no need to re-encode origin for this step
|
||||
match ascii_serialise_origin(&request.origin.borrow()) {
|
||||
Ok(request_origin) => {
|
||||
if request_origin != origin {
|
||||
return Err(());
|
||||
}
|
||||
},
|
||||
match *request.origin.borrow() {
|
||||
Origin::Origin(ref o) if o.ascii_serialization() == origin => {},
|
||||
_ => return Err(())
|
||||
}
|
||||
|
||||
|
@ -1086,39 +1071,6 @@ fn cors_check(request: Rc<Request>, response: &Response) -> Result<(), ()> {
|
|||
Err(())
|
||||
}
|
||||
|
||||
/// [ASCII serialisation of an origin](https://html.spec.whatwg.org/multipage/#ascii-serialisation-of-an-origin)
|
||||
fn ascii_serialise_origin(origin: &Origin) -> Result<String, ()> {
|
||||
|
||||
// Step 6
|
||||
match *origin {
|
||||
|
||||
// Step 1
|
||||
Origin::Origin(UrlOrigin::UID(_)) => Ok("null".to_owned()),
|
||||
|
||||
// Step 2
|
||||
Origin::Origin(UrlOrigin::Tuple(ref scheme, ref host, ref port)) => {
|
||||
|
||||
// Step 3
|
||||
// this step is handled by the format!()s later in the function
|
||||
|
||||
// Step 4
|
||||
// TODO throw a SecurityError in a meaningful way
|
||||
// let host = host.as_str();
|
||||
let host = try!(domain_to_ascii(host.serialize().as_str()).or(Err(())));
|
||||
|
||||
// Step 5
|
||||
let default_port = whatwg_scheme_type_mapper(scheme).default_port();
|
||||
|
||||
if Some(*port) == default_port {
|
||||
Ok(format!("{}://{}", scheme, host))
|
||||
} else {
|
||||
Ok(format!("{}://{}{}", scheme, host, port))
|
||||
}
|
||||
}
|
||||
_ => Err(())
|
||||
}
|
||||
}
|
||||
|
||||
fn global_user_agent() -> String {
|
||||
// TODO have a better useragent string
|
||||
const USER_AGENT_STRING: &'static str = "Servo";
|
||||
|
@ -1126,7 +1078,7 @@ fn global_user_agent() -> String {
|
|||
}
|
||||
|
||||
fn has_credentials(url: &Url) -> bool {
|
||||
!url.username().unwrap_or("").is_empty() || url.password().is_some()
|
||||
!url.username().is_empty() || url.password().is_some()
|
||||
}
|
||||
|
||||
fn is_no_store_cache(headers: &Headers) -> bool {
|
||||
|
@ -1156,19 +1108,6 @@ fn is_simple_method(m: &Method) -> bool {
|
|||
}
|
||||
}
|
||||
|
||||
fn includes_credentials(url: &Url) -> bool {
|
||||
|
||||
if url.password().is_some() {
|
||||
return true
|
||||
}
|
||||
|
||||
if let Some(name) = url.username() {
|
||||
return name.len() > 0
|
||||
}
|
||||
|
||||
false
|
||||
}
|
||||
|
||||
fn response_needs_revalidation(_response: &Response) -> bool {
|
||||
// TODO this function
|
||||
false
|
||||
|
|
|
@ -67,7 +67,7 @@ pub fn factory(load_data: LoadData,
|
|||
senders: LoadConsumer,
|
||||
classifier: Arc<MIMEClassifier>,
|
||||
cancel_listener: CancellationListener) {
|
||||
assert!(&*load_data.url.scheme == "file");
|
||||
assert!(load_data.url.scheme() == "file");
|
||||
spawn_named("file_loader".to_owned(), move || {
|
||||
let file_path = match load_data.url.to_file_path() {
|
||||
Ok(file_path) => file_path,
|
||||
|
|
|
@ -122,13 +122,11 @@ impl HstsList {
|
|||
}
|
||||
|
||||
pub fn secure_url(url: &Url) -> Url {
|
||||
if &*url.scheme == "http" {
|
||||
if url.scheme() == "http" {
|
||||
let mut secure_url = url.clone();
|
||||
secure_url.scheme = "https".to_owned();
|
||||
secure_url.relative_scheme_data_mut()
|
||||
.map(|scheme_data| {
|
||||
scheme_data.default_port = Some(443);
|
||||
});
|
||||
secure_url.set_scheme("https").unwrap();
|
||||
// .set_port(Some(443)) would set the port to None,
|
||||
// and should only be done when it was already None.
|
||||
secure_url
|
||||
} else {
|
||||
url.clone()
|
||||
|
|
|
@ -43,7 +43,7 @@ use time;
|
|||
use time::Tm;
|
||||
#[cfg(any(target_os = "macos", target_os = "linux"))]
|
||||
use tinyfiledialogs;
|
||||
use url::Url;
|
||||
use url::{Url, Position};
|
||||
use util::prefs;
|
||||
use util::resource_files::resources_dir_path;
|
||||
use util::thread::spawn_named;
|
||||
|
@ -89,7 +89,7 @@ pub fn factory(user_agent: String,
|
|||
Arc<MIMEClassifier>,
|
||||
CancellationListener) + Send> {
|
||||
box move |load_data: LoadData, senders, classifier, cancel_listener| {
|
||||
spawn_named(format!("http_loader for {}", load_data.url.serialize()), move || {
|
||||
spawn_named(format!("http_loader for {}", load_data.url), move || {
|
||||
load_for_consumer(load_data,
|
||||
senders,
|
||||
classifier,
|
||||
|
@ -120,11 +120,6 @@ pub fn read_block<R: Read>(reader: &mut R) -> Result<ReadResult, ()> {
|
|||
}
|
||||
}
|
||||
|
||||
fn inner_url(url: &Url) -> Url {
|
||||
let inner_url = url.non_relative_scheme_data().unwrap();
|
||||
Url::parse(inner_url).unwrap()
|
||||
}
|
||||
|
||||
pub struct HttpState {
|
||||
pub hsts_list: Arc<RwLock<HstsList>>,
|
||||
pub cookie_jar: Arc<RwLock<CookieStorage>>,
|
||||
|
@ -399,7 +394,7 @@ fn set_cookies_from_response(url: Url, response: &HttpResponse, cookie_jar: &Arc
|
|||
}
|
||||
|
||||
fn update_sts_list_from_response(url: &Url, response: &HttpResponse, hsts_list: &Arc<RwLock<HstsList>>) {
|
||||
if url.scheme != "https" {
|
||||
if url.scheme() != "https" {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -526,8 +521,8 @@ pub fn modify_request_headers(headers: &mut Headers,
|
|||
load_data: &LoadData) {
|
||||
// Ensure that the host header is set from the original url
|
||||
let host = Host {
|
||||
hostname: url.serialize_host().unwrap(),
|
||||
port: url.port_or_default()
|
||||
hostname: url.host_str().unwrap().to_owned(),
|
||||
port: url.port_or_known_default()
|
||||
};
|
||||
headers.set(host);
|
||||
|
||||
|
@ -576,14 +571,14 @@ fn auth_from_entry(auth_entry: &AuthCacheEntry, headers: &mut Headers) {
|
|||
}
|
||||
|
||||
fn auth_from_url(doc_url: &Url) -> Option<Authorization<Basic>> {
|
||||
match doc_url.username() {
|
||||
Some(username) if username != "" => {
|
||||
Some(Authorization(Basic {
|
||||
username: username.to_owned(),
|
||||
password: Some(doc_url.password().unwrap_or("").to_owned())
|
||||
}))
|
||||
},
|
||||
_ => None
|
||||
let username = doc_url.username();
|
||||
if username != "" {
|
||||
Some(Authorization(Basic {
|
||||
username: username.to_owned(),
|
||||
password: Some(doc_url.password().unwrap_or("").to_owned())
|
||||
}))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -739,16 +734,16 @@ pub fn load<A, B>(load_data: &LoadData,
|
|||
// real URL that should be used for which the source is to be viewed.
|
||||
// Change our existing URL to that and keep note that we are viewing
|
||||
// the source rather than rendering the contents of the URL.
|
||||
let viewing_source = doc_url.scheme == "view-source";
|
||||
let viewing_source = doc_url.scheme() == "view-source";
|
||||
if viewing_source {
|
||||
doc_url = inner_url(&load_data.url);
|
||||
doc_url = Url::parse(&load_data.url[Position::BeforeUsername..]).unwrap();
|
||||
}
|
||||
|
||||
// Loop to handle redirects.
|
||||
loop {
|
||||
iters = iters + 1;
|
||||
|
||||
if &*doc_url.scheme == "http" && request_must_be_secured(&doc_url, &http_state.hsts_list) {
|
||||
if doc_url.scheme() == "http" && request_must_be_secured(&doc_url, &http_state.hsts_list) {
|
||||
info!("{} is in the strict transport security list, requesting secure host", doc_url);
|
||||
doc_url = secure_url(&doc_url);
|
||||
}
|
||||
|
@ -758,8 +753,8 @@ pub fn load<A, B>(load_data: &LoadData,
|
|||
"too many redirects".to_owned()));
|
||||
}
|
||||
|
||||
if &*doc_url.scheme != "http" && &*doc_url.scheme != "https" {
|
||||
let s = format!("{} request, but we don't support that scheme", &*doc_url.scheme);
|
||||
if !matches!(doc_url.scheme(), "http" | "https") {
|
||||
let s = format!("{} request, but we don't support that scheme", doc_url.scheme());
|
||||
return Err(LoadError::new(doc_url, LoadErrorType::UnsupportedScheme, s));
|
||||
}
|
||||
|
||||
|
@ -767,7 +762,7 @@ pub fn load<A, B>(load_data: &LoadData,
|
|||
return Err(LoadError::new(doc_url, LoadErrorType::Cancelled, "load cancelled".to_owned()));
|
||||
}
|
||||
|
||||
info!("requesting {}", doc_url.serialize());
|
||||
info!("requesting {}", doc_url);
|
||||
|
||||
// Avoid automatically preserving request headers when redirects occur.
|
||||
// See https://bugzilla.mozilla.org/show_bug.cgi?id=401564 and
|
||||
|
@ -877,7 +872,7 @@ pub fn load<A, B>(load_data: &LoadData,
|
|||
});
|
||||
metadata.headers = Some(adjusted_headers);
|
||||
metadata.status = Some(response.status_raw().clone());
|
||||
metadata.https_state = if doc_url.scheme == "https" {
|
||||
metadata.https_state = if doc_url.scheme() == "https" {
|
||||
HttpsState::Modern
|
||||
} else {
|
||||
HttpsState::None
|
||||
|
|
|
@ -18,8 +18,8 @@ extern crate flate2;
|
|||
extern crate hyper;
|
||||
extern crate immeta;
|
||||
extern crate ipc_channel;
|
||||
#[macro_use]
|
||||
extern crate log;
|
||||
#[macro_use] extern crate log;
|
||||
#[macro_use] extern crate matches;
|
||||
#[macro_use]
|
||||
extern crate mime;
|
||||
extern crate mime_guess;
|
||||
|
|
|
@ -397,7 +397,7 @@ impl ResourceManager {
|
|||
});
|
||||
|
||||
let cancel_listener = CancellationListener::new(cancel_resource);
|
||||
let loader = match &*load_data.url.scheme {
|
||||
let loader = match load_data.url.scheme() {
|
||||
"chrome" => from_factory(chrome_loader::factory),
|
||||
"file" => from_factory(file_loader::factory),
|
||||
"http" | "https" | "view-source" => {
|
||||
|
@ -414,12 +414,12 @@ impl ResourceManager {
|
|||
"data" => from_factory(data_loader::factory),
|
||||
"about" => from_factory(about_loader::factory),
|
||||
_ => {
|
||||
debug!("resource_thread: no loader for scheme {}", load_data.url.scheme);
|
||||
debug!("resource_thread: no loader for scheme {}", load_data.url.scheme());
|
||||
send_error(load_data.url, NetworkError::Internal("no loader for scheme".to_owned()), consumer);
|
||||
return
|
||||
}
|
||||
};
|
||||
debug!("resource_thread: loading url: {}", load_data.url.serialize());
|
||||
debug!("resource_thread: loading url: {}", load_data.url);
|
||||
|
||||
loader.call_box((load_data,
|
||||
consumer,
|
||||
|
|
|
@ -221,15 +221,6 @@ impl StorageManager {
|
|||
}
|
||||
|
||||
fn origin_as_string(&self, url: Url) -> String {
|
||||
let mut origin = "".to_owned();
|
||||
origin.push_str(&url.scheme);
|
||||
origin.push_str("://");
|
||||
url.domain().map(|domain| origin.push_str(&domain));
|
||||
url.port().map(|port| {
|
||||
origin.push_str(":");
|
||||
origin.push_str(&port.to_string());
|
||||
});
|
||||
origin.push_str("/");
|
||||
origin
|
||||
url.origin().ascii_serialization()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,8 +32,8 @@ fn establish_a_websocket_connection(resource_url: &Url, net_url: (Host, String,
|
|||
-> WebSocketResult<(Headers, Sender<WebSocketStream>, Receiver<WebSocketStream>)> {
|
||||
|
||||
let host = Host {
|
||||
hostname: resource_url.serialize_host().unwrap(),
|
||||
port: resource_url.port_or_default()
|
||||
hostname: resource_url.host_str().unwrap().to_owned(),
|
||||
port: resource_url.port_or_known_default(),
|
||||
};
|
||||
|
||||
let mut request = try!(Client::connect(net_url));
|
||||
|
|
|
@ -23,11 +23,11 @@ path = "../plugins"
|
|||
[dependencies]
|
||||
heapsize = "0.3.0"
|
||||
heapsize_plugin = "0.1.2"
|
||||
hyper = { version = "0.8", features = [ "serde-serialization" ] }
|
||||
hyper = { version = "0.9", features = [ "serde-serialization" ] }
|
||||
image = "0.9"
|
||||
lazy_static = "0.1.15"
|
||||
log = "0.3.5"
|
||||
serde = "0.7"
|
||||
serde_macros = "0.7"
|
||||
url = {version = "0.5.7", features = ["heap_size"]}
|
||||
websocket = "0.16.1"
|
||||
url = {version = "1.0.0", features = ["heap_size"]}
|
||||
websocket = "0.17"
|
||||
|
|
|
@ -8,14 +8,14 @@ use std::collections::HashMap;
|
|||
use std::env;
|
||||
use std::fs::File;
|
||||
use std::io::{BufReader, Read};
|
||||
use std::net::{Ipv4Addr, Ipv6Addr};
|
||||
use std::net::IpAddr;
|
||||
use url::Url;
|
||||
|
||||
lazy_static! {
|
||||
static ref HOST_TABLE: Option<HashMap<String, String>> = create_host_table();
|
||||
static ref HOST_TABLE: Option<HashMap<String, IpAddr>> = create_host_table();
|
||||
}
|
||||
|
||||
fn create_host_table() -> Option<HashMap<String, String>> {
|
||||
fn create_host_table() -> Option<HashMap<String, IpAddr>> {
|
||||
//TODO: handle bad file path
|
||||
let path = match env::var("HOST_FILE") {
|
||||
Ok(host_file_path) => host_file_path,
|
||||
|
@ -36,21 +36,18 @@ fn create_host_table() -> Option<HashMap<String, String>> {
|
|||
return Some(parse_hostsfile(&lines));
|
||||
}
|
||||
|
||||
pub fn parse_hostsfile(hostsfile_content: &str) -> HashMap<String, String> {
|
||||
pub fn parse_hostsfile(hostsfile_content: &str) -> HashMap<String, IpAddr> {
|
||||
let mut host_table = HashMap::new();
|
||||
for line in hostsfile_content.split('\n') {
|
||||
let ip_host: Vec<&str> = line.trim().split(|c: char| c == ' ' || c == '\t').collect();
|
||||
if ip_host.len() > 1 {
|
||||
if ip_host[0].parse::<Ipv4Addr>().is_err() && ip_host[0].parse::<Ipv6Addr>().is_err() {
|
||||
continue
|
||||
}
|
||||
let address = ip_host[0].to_owned();
|
||||
|
||||
for token in ip_host.iter().skip(1) {
|
||||
if token.as_bytes()[0] == b'#' {
|
||||
break;
|
||||
if let Ok(address) = ip_host[0].parse::<IpAddr>() {
|
||||
for token in ip_host.iter().skip(1) {
|
||||
if token.as_bytes()[0] == b'#' {
|
||||
break;
|
||||
}
|
||||
host_table.insert((*token).to_owned(), address);
|
||||
}
|
||||
host_table.insert((*token).to_owned(), address.clone());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -63,12 +60,11 @@ pub fn replace_hosts(url: &Url) -> Url {
|
|||
})
|
||||
}
|
||||
|
||||
pub fn host_replacement(host_table: &HashMap<String, String>,
|
||||
pub fn host_replacement(host_table: &HashMap<String, IpAddr>,
|
||||
url: &Url) -> Url {
|
||||
url.domain().and_then(|domain|
|
||||
host_table.get(domain).map(|ip| {
|
||||
let mut net_url = url.clone();
|
||||
*net_url.domain_mut().unwrap() = ip.clone();
|
||||
net_url
|
||||
})).unwrap_or(url.clone())
|
||||
url.domain().and_then(|domain| host_table.get(domain).map(|ip| {
|
||||
let mut new_url = url.clone();
|
||||
new_url.set_ip_host(*ip).unwrap();
|
||||
new_url
|
||||
})).unwrap_or_else(|| url.clone())
|
||||
}
|
||||
|
|
|
@ -241,7 +241,7 @@ impl Request {
|
|||
}
|
||||
|
||||
pub fn current_url_string(&self) -> String {
|
||||
self.url_list.borrow().last().unwrap().serialize()
|
||||
self.url_list.borrow().last().unwrap().to_string()
|
||||
}
|
||||
|
||||
pub fn is_navigation_request(&self) -> bool {
|
||||
|
|
|
@ -74,7 +74,7 @@ fnv = "1.0"
|
|||
heapsize = "0.3.0"
|
||||
heapsize_plugin = "0.1.2"
|
||||
html5ever = {version = "0.5.1", features = ["heap_size", "unstable"]}
|
||||
hyper = { version = "0.8", features = [ "serde-serialization" ] }
|
||||
hyper = { version = "0.9", features = [ "serde-serialization" ] }
|
||||
image = "0.9"
|
||||
libc = "0.2"
|
||||
log = "0.3.5"
|
||||
|
@ -94,6 +94,6 @@ smallvec = "0.1"
|
|||
string_cache = {version = "0.2.12", features = ["heap_size", "unstable"]}
|
||||
time = "0.1.12"
|
||||
unicase = "1.0"
|
||||
url = {version = "0.5.7", features = ["heap_size"]}
|
||||
url = {version = "1.0.0", features = ["heap_size"]}
|
||||
uuid = { version = "0.2", features = ["v4"] }
|
||||
websocket = "0.16.1"
|
||||
websocket = "0.17"
|
||||
|
|
|
@ -26,7 +26,7 @@ use std::borrow::ToOwned;
|
|||
use std::sync::{Arc, Mutex};
|
||||
use time::{self, Timespec, now};
|
||||
use unicase::UniCase;
|
||||
use url::{SchemeData, Url};
|
||||
use url::Url;
|
||||
use util::thread::spawn_named;
|
||||
|
||||
/// Interface for network listeners concerned with CORS checks. Proper network requests
|
||||
|
@ -67,14 +67,13 @@ impl CORSRequest {
|
|||
headers: Headers,
|
||||
same_origin_data_url_flag: bool)
|
||||
-> Result<Option<CORSRequest>, ()> {
|
||||
if referer.scheme == destination.scheme && referer.host() == destination.host() &&
|
||||
referer.port() == destination.port() {
|
||||
if referer.origin() == destination.origin() {
|
||||
return Ok(None); // Not cross-origin, proceed with a normal fetch
|
||||
}
|
||||
match &*destination.scheme {
|
||||
match destination.scheme() {
|
||||
// As per (https://fetch.spec.whatwg.org/#main-fetch 5.1.9), about URLs can be fetched
|
||||
// the same as a basic request.
|
||||
"about" if destination.path() == Some(&["blank".to_owned()]) => Ok(None),
|
||||
"about" if destination.path() == "blank" => Ok(None),
|
||||
// As per (https://fetch.spec.whatwg.org/#main-fetch 5.1.9), data URLs can be fetched
|
||||
// the same as a basic request if the request's method is GET and the
|
||||
// same-origin data-URL flag is set.
|
||||
|
@ -98,11 +97,9 @@ impl CORSRequest {
|
|||
method: Method,
|
||||
headers: Headers)
|
||||
-> CORSRequest {
|
||||
if let SchemeData::Relative(ref mut data) = referer.scheme_data {
|
||||
data.path = vec![];
|
||||
}
|
||||
referer.fragment = None;
|
||||
referer.query = None;
|
||||
referer.set_fragment(None);
|
||||
referer.set_query(None);
|
||||
referer.set_path("");
|
||||
CORSRequest {
|
||||
origin: referer,
|
||||
destination: destination,
|
||||
|
@ -404,8 +401,10 @@ impl CORSCache {
|
|||
self.cleanup();
|
||||
// Credentials are not yet implemented here
|
||||
self.0.iter_mut().find(|e| {
|
||||
e.origin.scheme == request.origin.scheme && e.origin.host() == request.origin.host() &&
|
||||
e.origin.port() == request.origin.port() && e.url == request.destination &&
|
||||
e.origin.scheme() == request.origin.scheme() &&
|
||||
e.origin.host_str() == request.origin.host_str() &&
|
||||
e.origin.port() == request.origin.port() &&
|
||||
e.url == request.destination &&
|
||||
e.header_or_method.match_header(header_name)
|
||||
})
|
||||
}
|
||||
|
@ -430,8 +429,10 @@ impl CORSCache {
|
|||
self.cleanup();
|
||||
// Credentials are not yet implemented here
|
||||
self.0.iter_mut().find(|e| {
|
||||
e.origin.scheme == request.origin.scheme && e.origin.host() == request.origin.host() &&
|
||||
e.origin.port() == request.origin.port() && e.url == request.destination &&
|
||||
e.origin.scheme() == request.origin.scheme() &&
|
||||
e.origin.host_str() == request.origin.host_str() &&
|
||||
e.origin.port() == request.origin.port() &&
|
||||
e.url == request.destination &&
|
||||
e.header_or_method.match_method(method)
|
||||
})
|
||||
}
|
||||
|
@ -484,7 +485,7 @@ fn is_simple_method(m: &Method) -> bool {
|
|||
pub fn allow_cross_origin_request(req: &CORSRequest, headers: &Headers) -> bool {
|
||||
match headers.get::<AccessControlAllowOrigin>() {
|
||||
Some(&AccessControlAllowOrigin::Any) => true, // Not always true, depends on credentials mode
|
||||
Some(&AccessControlAllowOrigin::Value(ref url)) => req.origin.serialize() == *url,
|
||||
Some(&AccessControlAllowOrigin::Value(ref url)) => req.origin.as_str() == *url,
|
||||
Some(&AccessControlAllowOrigin::Null) |
|
||||
None => false,
|
||||
}
|
||||
|
|
|
@ -218,7 +218,7 @@ impl DedicatedWorkerGlobalScope {
|
|||
parent_sender: Box<ScriptChan + Send>,
|
||||
own_sender: Sender<(TrustedWorkerAddress, WorkerScriptMsg)>,
|
||||
receiver: Receiver<(TrustedWorkerAddress, WorkerScriptMsg)>) {
|
||||
let serialized_worker_url = worker_url.serialize();
|
||||
let serialized_worker_url = worker_url.to_string();
|
||||
spawn_named(format!("WebWorker for {}", serialized_worker_url), move || {
|
||||
thread_state::initialize(SCRIPT | IN_WORKER);
|
||||
|
||||
|
|
|
@ -515,7 +515,7 @@ impl Document {
|
|||
self.GetDocumentElement()
|
||||
} else {
|
||||
// Step 3 & 4
|
||||
String::from_utf8(percent_decode(fragid.as_bytes())).ok()
|
||||
percent_decode(fragid.as_bytes()).decode_utf8().ok()
|
||||
// Step 5
|
||||
.and_then(|decoded_fragid| self.get_element_by_id(&Atom::from(decoded_fragid)))
|
||||
// Step 6
|
||||
|
@ -1585,7 +1585,7 @@ impl LayoutDocumentHelpers for LayoutJS<Document> {
|
|||
|
||||
/// https://url.spec.whatwg.org/#network-scheme
|
||||
fn url_has_network_scheme(url: &Url) -> bool {
|
||||
match &*url.scheme {
|
||||
match url.scheme() {
|
||||
"ftp" | "http" | "https" => true,
|
||||
_ => false,
|
||||
}
|
||||
|
@ -1844,7 +1844,7 @@ impl DocumentMethods for Document {
|
|||
|
||||
// https://dom.spec.whatwg.org/#dom-document-url
|
||||
fn URL(&self) -> DOMString {
|
||||
DOMString::from(self.url().serialize())
|
||||
DOMString::from(self.url().as_str())
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#dom-document-activeelement
|
||||
|
@ -1886,7 +1886,7 @@ impl DocumentMethods for Document {
|
|||
|
||||
if let Some(host) = self.origin.host() {
|
||||
// Step 4.
|
||||
DOMString::from(host.serialize())
|
||||
DOMString::from(host.to_string())
|
||||
} else {
|
||||
// Step 3.
|
||||
DOMString::new()
|
||||
|
|
|
@ -1113,7 +1113,7 @@ impl Element {
|
|||
// https://html.spec.whatwg.org/multipage/#reflect
|
||||
// XXXManishearth this doesn't handle `javascript:` urls properly
|
||||
match base.join(&url) {
|
||||
Ok(parsed) => DOMString::from(parsed.serialize()),
|
||||
Ok(parsed) => DOMString::from(parsed.into_string()),
|
||||
Err(_) => DOMString::from(""),
|
||||
}
|
||||
}
|
||||
|
|
|
@ -82,7 +82,7 @@ impl EventSourceMethods for EventSource {
|
|||
|
||||
// https://html.spec.whatwg.org/multipage/#dom-eventsource-url
|
||||
fn Url(&self) -> DOMString {
|
||||
DOMString::from(self.url.serialize())
|
||||
DOMString::from(self.url.as_str())
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#dom-eventsource-withcredentials
|
||||
|
|
|
@ -397,7 +397,7 @@ impl EventTarget {
|
|||
// Step 1.6
|
||||
let window = document.window();
|
||||
|
||||
let url_serialized = CString::new(handler.url.serialize()).unwrap();
|
||||
let url_serialized = CString::new(handler.url.to_string()).unwrap();
|
||||
let name = CString::new(&**ty).unwrap();
|
||||
|
||||
static mut ARG_NAMES: [*const c_char; 1] = [b"event\0" as *const u8 as *const c_char];
|
||||
|
|
|
@ -28,7 +28,7 @@ use dom::virtualmethods::VirtualMethods;
|
|||
use num_traits::ToPrimitive;
|
||||
use std::default::Default;
|
||||
use string_cache::Atom;
|
||||
use url::{Url, UrlParser};
|
||||
use url::Url;
|
||||
use util::str::DOMString;
|
||||
|
||||
#[dom_struct]
|
||||
|
@ -63,9 +63,7 @@ impl HTMLAnchorElement {
|
|||
let attribute = self.upcast::<Element>().get_attribute(&ns!(), &atom!("href"));
|
||||
*self.url.borrow_mut() = attribute.and_then(|attribute| {
|
||||
let document = document_from_node(self);
|
||||
let mut parser = UrlParser::new();
|
||||
parser.base_url(document.url());
|
||||
parser.parse(&attribute.value()).ok()
|
||||
document.url().join(&attribute.value()).ok()
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -74,8 +72,7 @@ impl HTMLAnchorElement {
|
|||
// Step 1.
|
||||
match *self.url.borrow() {
|
||||
None => return,
|
||||
Some(ref url) if url.scheme == "blob" &&
|
||||
url.non_relative_scheme_data().is_some() => return,
|
||||
Some(ref url) if url.scheme() == "blob" && url.cannot_be_a_base() => return,
|
||||
_ => (),
|
||||
}
|
||||
|
||||
|
@ -86,7 +83,7 @@ impl HTMLAnchorElement {
|
|||
// https://html.spec.whatwg.org/multipage/#update-href
|
||||
fn update_href(&self) {
|
||||
self.upcast::<Element>().set_string_attribute(&atom!("href"),
|
||||
self.url.borrow().as_ref().unwrap().serialize().into());
|
||||
self.url.borrow().as_ref().unwrap().as_str().into());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -167,7 +164,7 @@ impl HTMLAnchorElementMethods for HTMLAnchorElement {
|
|||
|
||||
// Step 3.
|
||||
if let Some(url) = self.url.borrow_mut().as_mut() {
|
||||
if url.scheme == "javascript" { return; }
|
||||
if url.scheme() == "javascript" { return; }
|
||||
// Steps 4-5.
|
||||
UrlHelper::SetHash(url, value);
|
||||
// Step 6.
|
||||
|
@ -201,7 +198,7 @@ impl HTMLAnchorElementMethods for HTMLAnchorElement {
|
|||
|
||||
// Step 3.
|
||||
if let Some(url) = self.url.borrow_mut().as_mut() {
|
||||
if url.non_relative_scheme_data().is_some() {
|
||||
if url.cannot_be_a_base() {
|
||||
return;
|
||||
}
|
||||
// Step 4.
|
||||
|
@ -233,7 +230,7 @@ impl HTMLAnchorElementMethods for HTMLAnchorElement {
|
|||
|
||||
// Step 3.
|
||||
if let Some(url) = self.url.borrow_mut().as_mut() {
|
||||
if url.non_relative_scheme_data().is_some() {
|
||||
if url.cannot_be_a_base() {
|
||||
return;
|
||||
}
|
||||
// Step 4.
|
||||
|
@ -258,7 +255,7 @@ impl HTMLAnchorElementMethods for HTMLAnchorElement {
|
|||
}
|
||||
},
|
||||
// Step 5.
|
||||
Some(ref url) => url.serialize(),
|
||||
Some(ref url) => url.as_str().to_owned(),
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -289,7 +286,7 @@ impl HTMLAnchorElementMethods for HTMLAnchorElement {
|
|||
|
||||
// Step 3.
|
||||
if let Some(url) = self.url.borrow_mut().as_mut() {
|
||||
if url.host().is_none() || url.non_relative_scheme_data().is_some() {
|
||||
if url.host().is_none() || url.cannot_be_a_base() {
|
||||
return;
|
||||
}
|
||||
// Step 4.
|
||||
|
@ -319,7 +316,7 @@ impl HTMLAnchorElementMethods for HTMLAnchorElement {
|
|||
|
||||
// Step 3.
|
||||
if let Some(url) = self.url.borrow_mut().as_mut() {
|
||||
if url.non_relative_scheme_data().is_some() { return; }
|
||||
if url.cannot_be_a_base() { return; }
|
||||
// Step 5.
|
||||
UrlHelper::SetPathname(url, value);
|
||||
// Step 6.
|
||||
|
@ -348,8 +345,8 @@ impl HTMLAnchorElementMethods for HTMLAnchorElement {
|
|||
// Step 3.
|
||||
if let Some(url) = self.url.borrow_mut().as_mut() {
|
||||
if url.host().is_none() ||
|
||||
url.non_relative_scheme_data().is_some() ||
|
||||
url.scheme == "file" {
|
||||
url.cannot_be_a_base() ||
|
||||
url.scheme() == "file" {
|
||||
return;
|
||||
}
|
||||
// Step 4.
|
||||
|
@ -435,7 +432,7 @@ impl HTMLAnchorElementMethods for HTMLAnchorElement {
|
|||
|
||||
// Step 3.
|
||||
if let Some(url) = self.url.borrow_mut().as_mut() {
|
||||
if url.host().is_none() || url.non_relative_scheme_data().is_some() {
|
||||
if url.host().is_none() || url.cannot_be_a_base() {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -535,7 +532,7 @@ fn follow_hyperlink(subject: &Element, hyperlink_suffix: Option<String>) {
|
|||
};
|
||||
|
||||
// Step 7.
|
||||
debug!("following hyperlink to {}", url.serialize());
|
||||
debug!("following hyperlink to {}", url);
|
||||
let window = document.window();
|
||||
window.load_url(url);
|
||||
}
|
||||
|
|
|
@ -68,7 +68,7 @@ impl HTMLBaseElementMethods for HTMLBaseElement {
|
|||
|
||||
// Step 1.
|
||||
if !self.upcast::<Element>().has_attribute(&atom!("href")) {
|
||||
return DOMString::from(document.base_url().serialize());
|
||||
return DOMString::from(document.base_url().as_str());
|
||||
}
|
||||
|
||||
// Step 2.
|
||||
|
@ -81,7 +81,7 @@ impl HTMLBaseElementMethods for HTMLBaseElement {
|
|||
let url_record = fallback_base_url.join(&*url);
|
||||
|
||||
// Step 5, 6.
|
||||
DOMString::from(url_record.ok().map_or("".to_owned(), |record| record.serialize()))
|
||||
DOMString::from(url_record.as_ref().map(|url| url.as_str()).unwrap_or(""))
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#dom-base-href
|
||||
|
|
|
@ -44,7 +44,7 @@ use std::cell::Cell;
|
|||
use std::sync::mpsc::Sender;
|
||||
use string_cache::Atom;
|
||||
use task_source::dom_manipulation::DOMManipulationTask;
|
||||
use url::form_urlencoded::serialize;
|
||||
use url::form_urlencoded;
|
||||
use util::str::DOMString;
|
||||
|
||||
#[derive(JSTraceable, PartialEq, Clone, Copy, HeapSizeOf)]
|
||||
|
@ -269,7 +269,7 @@ impl HTMLFormElement {
|
|||
let mut action = submitter.action();
|
||||
// Step 8
|
||||
if action.is_empty() {
|
||||
action = DOMString::from(base.serialize());
|
||||
action = DOMString::from(base.as_str());
|
||||
}
|
||||
// Step 9-11
|
||||
let action_components = match base.join(&action) {
|
||||
|
@ -277,8 +277,7 @@ impl HTMLFormElement {
|
|||
Err(_) => return
|
||||
};
|
||||
// Step 12-15
|
||||
let _action = action_components.serialize();
|
||||
let scheme = action_components.scheme.clone();
|
||||
let scheme = action_components.scheme().to_owned();
|
||||
let enctype = submitter.enctype();
|
||||
let method = submitter.method();
|
||||
let _target = submitter.target();
|
||||
|
@ -290,7 +289,9 @@ impl HTMLFormElement {
|
|||
FormEncType::UrlEncoded => {
|
||||
let mime: mime::Mime = "application/x-www-form-urlencoded".parse().unwrap();
|
||||
load_data.headers.set(ContentType(mime));
|
||||
serialize(form_data.iter().map(|d| (&*d.name, &*d.value)))
|
||||
form_urlencoded::Serializer::new(String::new())
|
||||
.extend_pairs(form_data.into_iter().map(|field| (field.name, field.value)))
|
||||
.finish()
|
||||
}
|
||||
_ => "".to_owned() // TODO: Add serializers for the other encoding types
|
||||
};
|
||||
|
@ -302,7 +303,8 @@ impl HTMLFormElement {
|
|||
(_, FormMethod::FormDialog) => return, // Unimplemented
|
||||
// https://html.spec.whatwg.org/multipage/#submit-mutate-action
|
||||
("http", FormMethod::FormGet) | ("https", FormMethod::FormGet) => {
|
||||
load_data.url.query = Some(parsed_data);
|
||||
// FIXME(SimonSapin): use url.query_pairs_mut() here.
|
||||
load_data.url.set_query(Some(&*parsed_data));
|
||||
self.plan_to_navigate(load_data, &win);
|
||||
}
|
||||
// https://html.spec.whatwg.org/multipage/#submit-body
|
||||
|
|
|
@ -316,7 +316,7 @@ impl HTMLImageElementMethods for HTMLImageElement {
|
|||
fn CurrentSrc(&self) -> DOMString {
|
||||
let ref url = self.current_request.borrow().url;
|
||||
match *url {
|
||||
Some(ref url) => DOMString::from(url.serialize()),
|
||||
Some(ref url) => DOMString::from(url.as_str()),
|
||||
None => DOMString::from(""),
|
||||
}
|
||||
}
|
||||
|
|
|
@ -448,7 +448,7 @@ impl HTMLScriptElement {
|
|||
let window = window_from_node(self);
|
||||
let mut rval = RootedValue::new(window.get_cx(), UndefinedValue());
|
||||
window.evaluate_script_on_global_with_result(&*source,
|
||||
&*url.serialize(),
|
||||
url.as_str(),
|
||||
rval.handle_mut());
|
||||
|
||||
// Step 2.b.7.
|
||||
|
|
|
@ -99,7 +99,7 @@ macro_rules! make_url_or_base_getter(
|
|||
let url = element.get_url_attribute(&atom!($htmlname));
|
||||
if url.is_empty() {
|
||||
let window = window_from_node(self);
|
||||
DOMString::from(window.get_url().serialize())
|
||||
DOMString::from(window.get_url().into_string())
|
||||
} else {
|
||||
url
|
||||
}
|
||||
|
|
|
@ -274,8 +274,7 @@ impl AsyncResponseListener for ParserContext {
|
|||
match content_type {
|
||||
Some(ContentType(Mime(TopLevel::Image, _, _))) => {
|
||||
self.is_synthesized_document = true;
|
||||
let page = format!("<html><body><img src='{}' /></body></html>",
|
||||
self.url.serialize());
|
||||
let page = format!("<html><body><img src='{}' /></body></html>", self.url);
|
||||
parser.pending_input().borrow_mut().push(page);
|
||||
parser.parse_sync();
|
||||
},
|
||||
|
@ -336,7 +335,7 @@ impl AsyncResponseListener for ParserContext {
|
|||
parser.r().document().finish_load(LoadType::PageSource(self.url.clone()));
|
||||
|
||||
if let Err(err) = status {
|
||||
debug!("Failed to load page URL {}, error: {:?}", self.url.serialize(), err);
|
||||
debug!("Failed to load page URL {}, error: {:?}", self.url, err);
|
||||
// TODO(Savago): we should send a notification to callers #5463.
|
||||
}
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ use dom::urlhelper::UrlHelper;
|
|||
use dom::urlsearchparams::URLSearchParams;
|
||||
use std::borrow::ToOwned;
|
||||
use std::default::Default;
|
||||
use url::{Host, Url, UrlParser};
|
||||
use url::{Host, Url};
|
||||
use util::str::DOMString;
|
||||
|
||||
// https://url.spec.whatwg.org/#url
|
||||
|
@ -42,8 +42,13 @@ impl URL {
|
|||
global, URLBinding::Wrap)
|
||||
}
|
||||
|
||||
pub fn set_query(&self, query: String) {
|
||||
self.url.borrow_mut().query = Some(query);
|
||||
pub fn query_pairs(&self) -> Vec<(String, String)> {
|
||||
self.url.borrow().query_pairs().into_owned().collect()
|
||||
}
|
||||
|
||||
pub fn set_query_pairs(&self, pairs: &[(String, String)]) {
|
||||
let mut url = self.url.borrow_mut();
|
||||
url.query_pairs_mut().clear().extend_pairs(pairs);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -68,17 +73,11 @@ impl URL {
|
|||
}
|
||||
};
|
||||
// Step 3.
|
||||
let parsed_url = {
|
||||
let mut parser = UrlParser::new();
|
||||
if let Some(parsed_base) = parsed_base.as_ref() {
|
||||
parser.base_url(parsed_base);
|
||||
}
|
||||
match parser.parse(&url.0) {
|
||||
Ok(url) => url,
|
||||
Err(error) => {
|
||||
// Step 4.
|
||||
return Err(Error::Type(format!("could not parse URL: {}", error)));
|
||||
}
|
||||
let parsed_url = match Url::options().base_url(parsed_base.as_ref()).parse(&url.0) {
|
||||
Ok(url) => url,
|
||||
Err(error) => {
|
||||
// Step 4.
|
||||
return Err(Error::Type(format!("could not parse URL: {}", error)));
|
||||
}
|
||||
};
|
||||
// Step 5: Skip (see step 8 below).
|
||||
|
@ -145,6 +144,7 @@ impl URLMethods for URL {
|
|||
match Url::parse(&value.0) {
|
||||
Ok(url) => {
|
||||
*self.url.borrow_mut() = url;
|
||||
self.search_params.set(None); // To be re-initialized in the SearchParams getter.
|
||||
Ok(())
|
||||
},
|
||||
Err(error) => {
|
||||
|
@ -207,7 +207,7 @@ impl URLMethods for URL {
|
|||
fn SetSearch(&self, value: USVString) {
|
||||
UrlHelper::SetSearch(&mut self.url.borrow_mut(), value);
|
||||
if let Some(search_params) = self.search_params.get() {
|
||||
search_params.set_list(self.url.borrow().query_pairs().unwrap_or_else(|| vec![]));
|
||||
search_params.set_list(self.url.borrow().query_pairs().into_owned().collect());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -4,166 +4,31 @@
|
|||
|
||||
use dom::bindings::str::USVString;
|
||||
use std::borrow::ToOwned;
|
||||
use std::fmt::Write;
|
||||
use url::urlutils::{UrlUtils, UrlUtilsWrapper};
|
||||
use url::{Origin, SchemeData, Url, UrlParser};
|
||||
use url::{Url, quirks};
|
||||
|
||||
#[derive(HeapSizeOf)]
|
||||
pub struct UrlHelper;
|
||||
|
||||
impl UrlHelper {
|
||||
pub fn Hash(url: &Url) -> USVString {
|
||||
USVString(match url.fragment {
|
||||
None => "".to_owned(),
|
||||
Some(ref hash) if hash.is_empty() => "".to_owned(),
|
||||
Some(ref hash) => format!("#{}", hash)
|
||||
})
|
||||
}
|
||||
|
||||
pub fn SetHash(url: &mut Url, value: USVString) {
|
||||
url.fragment = Some(String::new());
|
||||
let mut wrapper = UrlUtilsWrapper { url: url, parser: &UrlParser::new() };
|
||||
let _ = wrapper.set_fragment(&value.0);
|
||||
}
|
||||
|
||||
pub fn Host(url: &Url) -> USVString {
|
||||
USVString(match url.scheme_data {
|
||||
SchemeData::NonRelative(..) => "".to_owned(),
|
||||
SchemeData::Relative(ref scheme_data) => {
|
||||
let mut host = scheme_data.host.serialize();
|
||||
if let Some(port) = scheme_data.port {
|
||||
write!(host, ":{}", port).unwrap();
|
||||
}
|
||||
host
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
pub fn SetHost(url: &mut Url, value: USVString) {
|
||||
let mut wrapper = UrlUtilsWrapper { url: url, parser: &UrlParser::new() };
|
||||
let _ = wrapper.set_host(&value.0);
|
||||
}
|
||||
|
||||
pub fn Origin(url: &Url) -> USVString {
|
||||
USVString(match url.origin() {
|
||||
Origin::UID(_) => {
|
||||
// https://html.spec.whatwg.org/multipage/#unicode-serialisation-of-an-origin
|
||||
// If the origin in question is not a scheme/host/port tuple,
|
||||
// then return the literal string "null" and abort these steps.
|
||||
"null".to_owned()
|
||||
},
|
||||
Origin::Tuple(protocol, host, _) => {
|
||||
let mut origin =
|
||||
format!(
|
||||
"{protocol}://{host}",
|
||||
protocol = protocol,
|
||||
host = host
|
||||
);
|
||||
if let Some(port) =
|
||||
// https://html.spec.whatwg.org/multipage/#unicode-serialisation-of-an-origin
|
||||
// only append the port # to the serialized origin if the port is different from
|
||||
// the default port for the protocol. If url.scheme_data.port is None, that
|
||||
// indicates that the port is a default port
|
||||
url.relative_scheme_data().and_then(|scheme| scheme.port) {
|
||||
write!(origin, ":{}", port).unwrap();
|
||||
};
|
||||
origin
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
pub fn Hostname(url: &Url) -> USVString {
|
||||
USVString(url.serialize_host().unwrap_or_else(|| "".to_owned()))
|
||||
}
|
||||
|
||||
pub fn SetHostname(url: &mut Url, value: USVString) {
|
||||
let mut wrapper = UrlUtilsWrapper { url: url, parser: &UrlParser::new() };
|
||||
let _ = wrapper.set_host_and_port(&value.0);
|
||||
}
|
||||
|
||||
pub fn Href(url: &Url) -> USVString {
|
||||
USVString(url.serialize())
|
||||
}
|
||||
|
||||
pub fn Password(url: &Url) -> USVString {
|
||||
USVString(url.password().unwrap_or("").to_owned())
|
||||
}
|
||||
|
||||
pub fn SetPassword(url: &mut Url, value: USVString) {
|
||||
let mut wrapper = UrlUtilsWrapper { url: url, parser: &UrlParser::new() };
|
||||
let _ = wrapper.set_password(&value.0);
|
||||
}
|
||||
|
||||
pub fn Pathname(url: &Url) -> USVString {
|
||||
USVString(match url.scheme_data {
|
||||
SchemeData::NonRelative(ref scheme_data) => scheme_data.clone(),
|
||||
SchemeData::Relative(..) => url.serialize_path().unwrap()
|
||||
})
|
||||
}
|
||||
|
||||
pub fn SetPathname(url: &mut Url, value: USVString) {
|
||||
if let Some(path) = url.path_mut() {
|
||||
path.clear();
|
||||
}
|
||||
let mut wrapper = UrlUtilsWrapper { url: url, parser: &UrlParser::new() };
|
||||
let _ = wrapper.set_path(&value.0);
|
||||
}
|
||||
|
||||
pub fn Port(url: &Url) -> USVString {
|
||||
USVString(match url.port() {
|
||||
None => "".to_owned(),
|
||||
Some(port) => port.to_string(),
|
||||
})
|
||||
}
|
||||
|
||||
pub fn SetPort(url: &mut Url, value: USVString) {
|
||||
let mut wrapper = UrlUtilsWrapper { url: url, parser: &UrlParser::new() };
|
||||
let _ = wrapper.set_port(&value.0);
|
||||
}
|
||||
|
||||
pub fn Protocol(url: &Url) -> USVString {
|
||||
USVString(format!("{}:", url.scheme.clone()))
|
||||
}
|
||||
|
||||
pub fn SetProtocol(url: &mut Url, value: USVString) {
|
||||
let mut wrapper = UrlUtilsWrapper { url: url, parser: &UrlParser::new() };
|
||||
let _ = wrapper.set_scheme(&value.0);
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#same-origin
|
||||
pub fn SameOrigin(urlA: &Url, urlB: &Url) -> bool {
|
||||
if urlA.host() != urlB.host() {
|
||||
return false
|
||||
}
|
||||
if urlA.scheme != urlB.scheme {
|
||||
return false
|
||||
}
|
||||
if urlA.port() != urlB.port() {
|
||||
return false
|
||||
}
|
||||
true
|
||||
}
|
||||
|
||||
pub fn Search(url: &Url) -> USVString {
|
||||
USVString(match url.query {
|
||||
None => "".to_owned(),
|
||||
Some(ref query) if query.is_empty() => "".to_owned(),
|
||||
Some(ref query) => format!("?{}", query)
|
||||
})
|
||||
}
|
||||
|
||||
pub fn SetSearch(url: &mut Url, value: USVString) {
|
||||
url.query = Some(String::new());
|
||||
let mut wrapper = UrlUtilsWrapper { url: url, parser: &UrlParser::new() };
|
||||
let _ = wrapper.set_query(&value.0);
|
||||
}
|
||||
|
||||
pub fn Username(url: &Url) -> USVString {
|
||||
USVString(url.username().unwrap_or("").to_owned())
|
||||
}
|
||||
|
||||
pub fn SetUsername(url: &mut Url, value: USVString) {
|
||||
let mut wrapper = UrlUtilsWrapper { url: url, parser: &UrlParser::new() };
|
||||
let _ = wrapper.set_username(&value.0);
|
||||
}
|
||||
pub fn SameOrigin(urlA: &Url, urlB: &Url) -> bool { urlA.origin() == urlB.origin() }
|
||||
pub fn Origin(url: &Url) -> USVString { USVString(quirks::origin(url)) }
|
||||
pub fn Href(url: &Url) -> USVString { USVString(quirks::href(url).to_owned()) }
|
||||
pub fn Hash(url: &Url) -> USVString { USVString(quirks::hash(url).to_owned()) }
|
||||
pub fn Host(url: &Url) -> USVString { USVString(quirks::host(url).to_owned()) }
|
||||
pub fn Port(url: &Url) -> USVString { USVString(quirks::port(url).to_owned()) }
|
||||
pub fn Search(url: &Url) -> USVString { USVString(quirks::search(url).to_owned()) }
|
||||
pub fn Hostname(url: &Url) -> USVString { USVString(quirks::hostname(url).to_owned()) }
|
||||
pub fn Password(url: &Url) -> USVString { USVString(quirks::password(url).to_owned()) }
|
||||
pub fn Pathname(url: &Url) -> USVString { USVString(quirks::pathname(url).to_owned()) }
|
||||
pub fn Protocol(url: &Url) -> USVString { USVString(quirks::protocol(url).to_owned()) }
|
||||
pub fn Username(url: &Url) -> USVString { USVString(quirks::username(url).to_owned()) }
|
||||
pub fn SetHash(url: &mut Url, value: USVString) { quirks::set_hash(url, &value.0) }
|
||||
pub fn SetHost(url: &mut Url, value: USVString) { let _ = quirks::set_host(url, &value.0); }
|
||||
pub fn SetPort(url: &mut Url, value: USVString) { let _ = quirks::set_port(url, &value.0); }
|
||||
pub fn SetSearch(url: &mut Url, value: USVString) { quirks::set_search(url, &value.0) }
|
||||
pub fn SetPathname(url: &mut Url, value: USVString) { quirks::set_pathname(url, &value.0) }
|
||||
pub fn SetHostname(url: &mut Url, value: USVString) { let _ = quirks::set_hostname(url, &value.0); }
|
||||
pub fn SetPassword(url: &mut Url, value: USVString) { let _ = quirks::set_password(url, &value.0); }
|
||||
pub fn SetProtocol(url: &mut Url, value: USVString) { let _ = quirks::set_protocol(url, &value.0); }
|
||||
pub fn SetUsername(url: &mut Url, value: USVString) { let _ = quirks::set_username(url, &value.0); }
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ use dom::bindings::str::USVString;
|
|||
use dom::bindings::weakref::MutableWeakRef;
|
||||
use dom::url::URL;
|
||||
use encoding::types::EncodingRef;
|
||||
use url::form_urlencoded::{parse, serialize_with_encoding};
|
||||
use url::form_urlencoded;
|
||||
use util::str::DOMString;
|
||||
|
||||
// https://url.spec.whatwg.org/#interface-urlsearchparams
|
||||
|
@ -31,7 +31,7 @@ impl URLSearchParams {
|
|||
fn new_inherited(url: Option<&URL>) -> URLSearchParams {
|
||||
URLSearchParams {
|
||||
reflector_: Reflector::new(),
|
||||
list: DOMRefCell::new(vec![]),
|
||||
list: DOMRefCell::new(url.map_or(Vec::new(), |url| url.query_pairs())),
|
||||
url: MutableWeakRef::new(url),
|
||||
}
|
||||
}
|
||||
|
@ -49,7 +49,8 @@ impl URLSearchParams {
|
|||
match init {
|
||||
Some(USVStringOrURLSearchParams::USVString(init)) => {
|
||||
// Step 2.
|
||||
*query.list.borrow_mut() = parse(init.0.as_bytes());
|
||||
*query.list.borrow_mut() = form_urlencoded::parse(init.0.as_bytes())
|
||||
.into_owned().collect();
|
||||
},
|
||||
Some(USVStringOrURLSearchParams::URLSearchParams(init)) => {
|
||||
// Step 3.
|
||||
|
@ -110,26 +111,28 @@ impl URLSearchParamsMethods for URLSearchParams {
|
|||
|
||||
// https://url.spec.whatwg.org/#dom-urlsearchparams-set
|
||||
fn Set(&self, name: USVString, value: USVString) {
|
||||
// Step 1.
|
||||
let mut list = self.list.borrow_mut();
|
||||
let mut index = None;
|
||||
let mut i = 0;
|
||||
list.retain(|&(ref k, _)| {
|
||||
if index.is_none() {
|
||||
if k == &name.0 {
|
||||
index = Some(i);
|
||||
{
|
||||
// Step 1.
|
||||
let mut list = self.list.borrow_mut();
|
||||
let mut index = None;
|
||||
let mut i = 0;
|
||||
list.retain(|&(ref k, _)| {
|
||||
if index.is_none() {
|
||||
if k == &name.0 {
|
||||
index = Some(i);
|
||||
} else {
|
||||
i += 1;
|
||||
}
|
||||
true
|
||||
} else {
|
||||
i += 1;
|
||||
k != &name.0
|
||||
}
|
||||
true
|
||||
} else {
|
||||
k != &name.0
|
||||
}
|
||||
});
|
||||
match index {
|
||||
Some(index) => list[index].1 = value.0,
|
||||
None => list.push((name.0, value.0)), // Step 2.
|
||||
};
|
||||
});
|
||||
match index {
|
||||
Some(index) => list[index].1 = value.0,
|
||||
None => list.push((name.0, value.0)), // Step 2.
|
||||
};
|
||||
} // Un-borrow self.list
|
||||
// Step 3.
|
||||
self.update_steps();
|
||||
}
|
||||
|
@ -145,7 +148,10 @@ impl URLSearchParams {
|
|||
// https://url.spec.whatwg.org/#concept-urlencoded-serializer
|
||||
pub fn serialize(&self, encoding: Option<EncodingRef>) -> String {
|
||||
let list = self.list.borrow();
|
||||
serialize_with_encoding(list.iter(), encoding)
|
||||
form_urlencoded::Serializer::new(String::new())
|
||||
.encoding_override(encoding)
|
||||
.extend_pairs(&*list)
|
||||
.finish()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -154,7 +160,7 @@ impl URLSearchParams {
|
|||
// https://url.spec.whatwg.org/#concept-urlsearchparams-update
|
||||
fn update_steps(&self) {
|
||||
if let Some(url) = self.url.root() {
|
||||
url.set_query(self.serialize(None));
|
||||
url.set_query_pairs(&self.list.borrow())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -210,7 +210,7 @@ impl WebSocket {
|
|||
// Step 2: Disallow https -> ws connections.
|
||||
|
||||
// Step 3: Potentially block access to some ports.
|
||||
let port: u16 = resource_url.port_or_default().unwrap();
|
||||
let port: u16 = resource_url.port_or_known_default().unwrap();
|
||||
|
||||
if BLOCKED_PORTS_LIST.iter().any(|&p| p == port) {
|
||||
return Err(Error::Security);
|
||||
|
@ -356,7 +356,7 @@ impl WebSocketMethods for WebSocket {
|
|||
|
||||
// https://html.spec.whatwg.org/multipage/#dom-websocket-url
|
||||
fn Url(&self) -> DOMString {
|
||||
DOMString::from(self.url.serialize())
|
||||
DOMString::from(self.url.as_str())
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#dom-websocket-readystate
|
||||
|
|
|
@ -225,7 +225,7 @@ impl WorkerGlobalScopeMethods for WorkerGlobalScope {
|
|||
};
|
||||
|
||||
match self.runtime.evaluate_script(
|
||||
self.reflector().get_jsobject(), source, url.serialize(), 1) {
|
||||
self.reflector().get_jsobject(), source, url.to_string(), 1) {
|
||||
Ok(_) => (),
|
||||
Err(_) => {
|
||||
println!("evaluate_script failed");
|
||||
|
@ -317,7 +317,7 @@ impl WorkerGlobalScopeMethods for WorkerGlobalScope {
|
|||
impl WorkerGlobalScope {
|
||||
pub fn execute_script(&self, source: DOMString) {
|
||||
match self.runtime.evaluate_script(
|
||||
self.reflector().get_jsobject(), String::from(source), self.worker_url.serialize(), 1) {
|
||||
self.reflector().get_jsobject(), String::from(source), self.worker_url.to_string(), 1) {
|
||||
Ok(_) => (),
|
||||
Err(_) => {
|
||||
if self.is_closing() {
|
||||
|
|
|
@ -60,8 +60,7 @@ use std::sync::{Arc, Mutex};
|
|||
use string_cache::Atom;
|
||||
use time;
|
||||
use timers::{OneshotTimerCallback, OneshotTimerHandle};
|
||||
use url::Url;
|
||||
use url::percent_encoding::{utf8_percent_encode, USERNAME_ENCODE_SET, PASSWORD_ENCODE_SET};
|
||||
use url::{Url, Position};
|
||||
use util::prefs;
|
||||
use util::str::DOMString;
|
||||
|
||||
|
@ -360,15 +359,10 @@ impl XMLHttpRequestMethods for XMLHttpRequest {
|
|||
|
||||
// Step 9
|
||||
if parsed_url.host().is_some() {
|
||||
if let Some(scheme_data) = parsed_url.relative_scheme_data_mut() {
|
||||
if let Some(user_str) = username {
|
||||
scheme_data.username = utf8_percent_encode(&user_str.0, USERNAME_ENCODE_SET);
|
||||
|
||||
// ensure that the password is mutated when a username is provided
|
||||
scheme_data.password = password.map(|pass_str| {
|
||||
utf8_percent_encode(&pass_str.0, PASSWORD_ENCODE_SET)
|
||||
});
|
||||
}
|
||||
if let Some(user_str) = username {
|
||||
parsed_url.set_username(&user_str.0).unwrap();
|
||||
let password = password.as_ref().map(|pass_str| &*pass_str.0);
|
||||
parsed_url.set_password(password).unwrap();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -628,24 +622,8 @@ impl XMLHttpRequestMethods for XMLHttpRequest {
|
|||
true);
|
||||
match cors_request {
|
||||
Ok(None) => {
|
||||
let mut buf = String::new();
|
||||
buf.push_str(&referer_url.scheme);
|
||||
buf.push_str("://");
|
||||
|
||||
if let Some(ref h) = referer_url.serialize_host() {
|
||||
buf.push_str(h);
|
||||
}
|
||||
|
||||
if let Some(ref p) = referer_url.port().as_ref() {
|
||||
buf.push_str(":");
|
||||
buf.push_str(&p.to_string());
|
||||
}
|
||||
|
||||
if let Some(ref h) = referer_url.serialize_path() {
|
||||
buf.push_str(h);
|
||||
}
|
||||
|
||||
self.request_headers.borrow_mut().set_raw("Referer".to_owned(), vec![buf.into_bytes()]);
|
||||
let bytes = referer_url[..Position::AfterPath].as_bytes().to_vec();
|
||||
self.request_headers.borrow_mut().set_raw("Referer".to_owned(), vec![bytes]);
|
||||
},
|
||||
Ok(Some(ref req)) => self.insert_trusted_header("origin".to_owned(),
|
||||
req.origin.to_string()),
|
||||
|
@ -909,7 +887,7 @@ impl XMLHttpRequest {
|
|||
debug!("Bypassing cross origin check");
|
||||
}
|
||||
|
||||
*self.response_url.borrow_mut() = metadata.final_url.serialize_no_fragment();
|
||||
*self.response_url.borrow_mut() = metadata.final_url[..Position::AfterQuery].to_owned();
|
||||
|
||||
// XXXManishearth Clear cache entries in case of a network error
|
||||
self.process_partial_response(XHRProgress::HeadersReceived(gen_id, metadata.headers, metadata.status));
|
||||
|
|
|
@ -2,9 +2,10 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use std::cell::RefCell;
|
||||
use ref_filter_map::ref_filter_map;
|
||||
use std::cell::{RefCell, Ref};
|
||||
use std::rc::Rc;
|
||||
use url::{OpaqueOrigin, Origin as UrlOrigin};
|
||||
use url::Origin as UrlOrigin;
|
||||
use url::{Url, Host};
|
||||
|
||||
/// A representation of an [origin](https://html.spec.whatwg.org/multipage/#origin-2).
|
||||
|
@ -21,9 +22,8 @@ no_jsmanaged_fields!(Origin);
|
|||
impl Origin {
|
||||
/// Create a new origin comprising a unique, opaque identifier.
|
||||
pub fn opaque_identifier() -> Origin {
|
||||
let opaque = UrlOrigin::UID(OpaqueOrigin::new());
|
||||
Origin {
|
||||
inner: Rc::new(RefCell::new(opaque)),
|
||||
inner: Rc::new(RefCell::new(UrlOrigin::new_opaque())),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -40,18 +40,15 @@ impl Origin {
|
|||
|
||||
/// Does this origin represent a host/scheme/port tuple?
|
||||
pub fn is_scheme_host_port_tuple(&self) -> bool {
|
||||
match *self.inner.borrow() {
|
||||
UrlOrigin::Tuple(..) => true,
|
||||
UrlOrigin::UID(..) => false,
|
||||
}
|
||||
self.inner.borrow().is_tuple()
|
||||
}
|
||||
|
||||
/// Return the host associated with this origin.
|
||||
pub fn host(&self) -> Option<Host> {
|
||||
match *self.inner.borrow() {
|
||||
UrlOrigin::Tuple(_, ref host, _) => Some(host.clone()),
|
||||
UrlOrigin::UID(..) => None,
|
||||
}
|
||||
pub fn host(&self) -> Option<Ref<Host<String>>> {
|
||||
ref_filter_map(self.inner.borrow(), |origin| match *origin {
|
||||
UrlOrigin::Tuple(_, ref host, _) => Some(host),
|
||||
UrlOrigin::Opaque(..) => None,
|
||||
})
|
||||
}
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#same-origin
|
||||
|
|
|
@ -100,7 +100,7 @@ use task_source::history_traversal::HistoryTraversalTaskSource;
|
|||
use task_source::networking::NetworkingTaskSource;
|
||||
use task_source::user_interaction::UserInteractionTaskSource;
|
||||
use time::Tm;
|
||||
use url::Url;
|
||||
use url::{Url, Position};
|
||||
use util::opts;
|
||||
use util::str::DOMString;
|
||||
use util::thread;
|
||||
|
@ -1132,8 +1132,7 @@ impl ScriptThread {
|
|||
|
||||
if let Some(root_page) = self.page.borrow().as_ref() {
|
||||
for it_page in root_page.iter() {
|
||||
let current_url = it_page.document().url().serialize();
|
||||
urls.push(current_url.clone());
|
||||
let current_url = it_page.document().url().to_string();
|
||||
|
||||
for child in it_page.document().upcast::<Node>().traverse_preorder() {
|
||||
dom_tree_size += heap_size_of_self_and_children(&*child);
|
||||
|
@ -1145,7 +1144,8 @@ impl ScriptThread {
|
|||
path: path![format!("url({})", current_url), "dom-tree"],
|
||||
kind: ReportKind::ExplicitJemallocHeapSize,
|
||||
size: dom_tree_size,
|
||||
})
|
||||
});
|
||||
urls.push(current_url);
|
||||
}
|
||||
}
|
||||
let path_seg = format!("url({})", urls.join(", "));
|
||||
|
@ -1387,7 +1387,7 @@ impl ScriptThread {
|
|||
let ConstellationChan(ref chan) = self.constellation_chan;
|
||||
chan.send(ConstellationMsg::SetFinalUrl(incomplete.pipeline_id, final_url.clone())).unwrap();
|
||||
}
|
||||
debug!("ScriptThread: loading {} on page {:?}", incomplete.url.serialize(), incomplete.pipeline_id);
|
||||
debug!("ScriptThread: loading {} on page {:?}", incomplete.url, incomplete.pipeline_id);
|
||||
|
||||
let frame_element = incomplete.parent_info.and_then(|(parent_id, subpage_id)| {
|
||||
// The root page may not exist yet, if the parent of this frame
|
||||
|
@ -1554,30 +1554,22 @@ impl ScriptThread {
|
|||
// Notify devtools that a new script global exists.
|
||||
self.notify_devtools(document.Title(), final_url.clone(), (page.pipeline(), None));
|
||||
|
||||
let is_javascript = incomplete.url.scheme == "javascript";
|
||||
let is_javascript = incomplete.url.scheme() == "javascript";
|
||||
let parse_input = if is_javascript {
|
||||
use url::percent_encoding::percent_decode_to;
|
||||
use url::percent_encoding::percent_decode;
|
||||
|
||||
// Turn javascript: URL into JS code to eval, according to the steps in
|
||||
// https://html.spec.whatwg.org/multipage/#javascript-protocol
|
||||
let _ar = JSAutoRequest::new(self.get_cx());
|
||||
let mut script_source_bytes = Vec::new();
|
||||
// Start with the scheme data of the parsed URL (5.), while percent-decoding (8.)
|
||||
percent_decode_to(incomplete.url.non_relative_scheme_data().unwrap().as_bytes(),
|
||||
&mut script_source_bytes);
|
||||
// Append question mark and query component, if any (6.), while percent-decoding (8.)
|
||||
if let Some(ref query) = incomplete.url.query {
|
||||
script_source_bytes.push(b'?');
|
||||
percent_decode_to(query.as_bytes(), &mut script_source_bytes);
|
||||
}
|
||||
// Append number sign and fragment component if any (7.), while percent-decoding (8.)
|
||||
if let Some(ref fragment) = incomplete.url.fragment {
|
||||
script_source_bytes.push(b'#');
|
||||
percent_decode_to(fragment.as_bytes(), &mut script_source_bytes);
|
||||
}
|
||||
|
||||
// UTF-8 decode (9.)
|
||||
let script_source = String::from_utf8_lossy(&script_source_bytes);
|
||||
// This slice of the URL’s serialization is equivalent to (5.) to (7.):
|
||||
// Start with the scheme data of the parsed URL;
|
||||
// append question mark and query component, if any;
|
||||
// append number sign and fragment component if any.
|
||||
let encoded = &incomplete.url[Position::BeforePath..];
|
||||
|
||||
// Percent-decode (8.) and UTF-8 decode (9.)
|
||||
let script_source = percent_decode(encoded.as_bytes()).decode_utf8_lossy();
|
||||
|
||||
// Script source is ready to be evaluated (11.)
|
||||
unsafe {
|
||||
|
@ -1706,7 +1698,7 @@ impl ScriptThread {
|
|||
.and_then(|href| {
|
||||
let value = href.value();
|
||||
let url = document.url();
|
||||
url.join(&value).map(|url| url.serialize()).ok()
|
||||
url.join(&value).map(|url| url.to_string()).ok()
|
||||
});
|
||||
|
||||
let event = ConstellationMsg::NodeStatus(status);
|
||||
|
@ -1795,14 +1787,14 @@ impl ScriptThread {
|
|||
// Step 8.
|
||||
{
|
||||
let nurl = &load_data.url;
|
||||
if let Some(ref fragment) = nurl.fragment {
|
||||
if let Some(fragment) = nurl.fragment() {
|
||||
let page = get_page(&self.root_page(), pipeline_id);
|
||||
let document = page.document();
|
||||
let document = document.r();
|
||||
let url = document.url();
|
||||
if url.scheme == nurl.scheme && url.scheme_data == nurl.scheme_data &&
|
||||
url.query == nurl.query && load_data.method == Method::Get {
|
||||
match document.find_fragment_node(&*fragment) {
|
||||
if &url[..Position::AfterQuery] == &nurl[..Position::AfterQuery] &&
|
||||
load_data.method == Method::Get {
|
||||
match document.find_fragment_node(fragment) {
|
||||
Some(ref node) => {
|
||||
self.scroll_fragment_point(pipeline_id, node.r());
|
||||
}
|
||||
|
@ -1881,7 +1873,7 @@ impl ScriptThread {
|
|||
sender: action_sender,
|
||||
};
|
||||
|
||||
if load_data.url.scheme == "javascript" {
|
||||
if load_data.url.scheme() == "javascript" {
|
||||
load_data.url = Url::parse("about:blank").unwrap();
|
||||
}
|
||||
|
||||
|
@ -1928,7 +1920,7 @@ impl ScriptThread {
|
|||
// https://html.spec.whatwg.org/multipage/#the-end steps 3-4.
|
||||
document.process_deferred_scripts();
|
||||
|
||||
window.set_fragment_name(final_url.fragment.clone());
|
||||
window.set_fragment_name(final_url.fragment().map(str::to_owned));
|
||||
}
|
||||
|
||||
fn handle_css_error_reporting(&self, pipeline_id: PipelineId, filename: String,
|
||||
|
|
|
@ -48,4 +48,4 @@ offscreen_gl_context = "0.1.2"
|
|||
serde = "0.7"
|
||||
serde_macros = "0.7"
|
||||
time = "0.1.12"
|
||||
url = {version = "0.5.7", features = ["heap_size"]}
|
||||
url = {version = "1.0.0", features = ["heap_size"]}
|
||||
|
|
|
@ -39,7 +39,7 @@ dependencies = [
|
|||
"script_traits 0.0.1",
|
||||
"style 0.0.1",
|
||||
"style_tests 0.0.1",
|
||||
"url 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"util 0.0.1",
|
||||
"util_tests 0.0.1",
|
||||
"webdriver_server 0.0.1",
|
||||
|
@ -308,7 +308,7 @@ dependencies = [
|
|||
"serde_macros 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"style_traits 0.0.1",
|
||||
"time 0.1.34 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"util 0.0.1",
|
||||
"webrender 0.1.0 (git+https://github.com/servo/webrender)",
|
||||
"webrender_traits 0.1.0 (git+https://github.com/servo/webrender_traits)",
|
||||
|
@ -316,13 +316,13 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "cookie"
|
||||
version = "0.2.2"
|
||||
version = "0.2.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"openssl 0.7.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"time 0.1.34 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -401,7 +401,7 @@ name = "devtools"
|
|||
version = "0.0.1"
|
||||
dependencies = [
|
||||
"devtools_traits 0.0.1",
|
||||
"hyper 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"hyper 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"ipc-channel 0.2.2 (git+https://github.com/servo/ipc-channel)",
|
||||
"msg 0.0.1",
|
||||
"plugins 0.0.1",
|
||||
|
@ -419,14 +419,14 @@ dependencies = [
|
|||
"bitflags 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"heapsize 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"heapsize_plugin 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"hyper 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"hyper 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"ipc-channel 0.2.2 (git+https://github.com/servo/ipc-channel)",
|
||||
"msg 0.0.1",
|
||||
"plugins 0.0.1",
|
||||
"serde 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_macros 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"time 0.1.34 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -702,7 +702,7 @@ dependencies = [
|
|||
"style_traits 0.0.1",
|
||||
"time 0.1.34 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"unicode-script 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"util 0.0.1",
|
||||
"webrender_traits 0.1.0 (git+https://github.com/servo/webrender_traits)",
|
||||
]
|
||||
|
@ -778,7 +778,7 @@ dependencies = [
|
|||
"servo-egl 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"servo-glutin 0.4.15 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"style_traits 0.0.1",
|
||||
"url 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"util 0.0.1",
|
||||
"x11 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
@ -883,10 +883,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
|
||||
[[package]]
|
||||
name = "hyper"
|
||||
version = "0.8.0"
|
||||
version = "0.9.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"cookie 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cookie 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"httparse 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"language-tags 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -900,7 +900,17 @@ dependencies = [
|
|||
"traitobject 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"typeable 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"unicase 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "idna"
|
||||
version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"matches 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"unicode-bidi 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"unicode-normalization 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1062,7 +1072,7 @@ dependencies = [
|
|||
"time 0.1.34 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"unicode-bidi 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"unicode-script 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"util 0.0.1",
|
||||
"webrender_traits 0.1.0 (git+https://github.com/servo/webrender_traits)",
|
||||
]
|
||||
|
@ -1086,7 +1096,7 @@ dependencies = [
|
|||
"script_traits 0.0.1",
|
||||
"serde 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_macros 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"util 0.0.1",
|
||||
"webrender_traits 0.1.0 (git+https://github.com/servo/webrender_traits)",
|
||||
]
|
||||
|
@ -1243,14 +1253,14 @@ dependencies = [
|
|||
"euclid 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"heapsize 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"heapsize_plugin 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"hyper 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"hyper 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"ipc-channel 0.2.2 (git+https://github.com/servo/ipc-channel)",
|
||||
"layers 0.2.4 (git+https://github.com/servo/rust-layers)",
|
||||
"plugins 0.0.1",
|
||||
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_macros 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"util 0.0.1",
|
||||
"webrender_traits 0.1.0 (git+https://github.com/servo/webrender_traits)",
|
||||
]
|
||||
|
@ -1260,13 +1270,14 @@ name = "net"
|
|||
version = "0.0.1"
|
||||
dependencies = [
|
||||
"brotli 0.3.20 (git+https://github.com/ende76/brotli-rs)",
|
||||
"cookie 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cookie 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"devtools_traits 0.0.1",
|
||||
"flate2 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"hyper 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"hyper 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"immeta 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"ipc-channel 0.2.2 (git+https://github.com/servo/ipc-channel)",
|
||||
"log 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"matches 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"mime 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"mime_guess 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"msg 0.0.1",
|
||||
|
@ -1278,11 +1289,11 @@ dependencies = [
|
|||
"time 0.1.34 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"tinyfiledialogs 0.1.0 (git+https://github.com/jdm/tinyfiledialogs)",
|
||||
"unicase 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"util 0.0.1",
|
||||
"uuid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"webrender_traits 0.1.0 (git+https://github.com/servo/webrender_traits)",
|
||||
"websocket 0.16.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"websocket 0.17.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1301,10 +1312,10 @@ dependencies = [
|
|||
name = "net_tests"
|
||||
version = "0.0.1"
|
||||
dependencies = [
|
||||
"cookie 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cookie 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"devtools_traits 0.0.1",
|
||||
"flate2 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"hyper 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"hyper 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"ipc-channel 0.2.2 (git+https://github.com/servo/ipc-channel)",
|
||||
"msg 0.0.1",
|
||||
"net 0.0.1",
|
||||
|
@ -1312,7 +1323,7 @@ dependencies = [
|
|||
"plugins 0.0.1",
|
||||
"time 0.1.34 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"unicase 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"util 0.0.1",
|
||||
]
|
||||
|
||||
|
@ -1322,7 +1333,7 @@ version = "0.0.1"
|
|||
dependencies = [
|
||||
"heapsize 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"heapsize_plugin 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"hyper 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"hyper 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"image 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"ipc-channel 0.2.2 (git+https://github.com/servo/ipc-channel)",
|
||||
"lazy_static 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -1331,9 +1342,9 @@ dependencies = [
|
|||
"plugins 0.0.1",
|
||||
"serde 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_macros 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"util 0.0.1",
|
||||
"websocket 0.16.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"websocket 0.17.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1763,7 +1774,7 @@ dependencies = [
|
|||
"heapsize 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"heapsize_plugin 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"html5ever 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"hyper 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"hyper 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"image 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"ipc-channel 0.2.2 (git+https://github.com/servo/ipc-channel)",
|
||||
"js 0.1.2 (git+https://github.com/servo/rust-mozjs)",
|
||||
|
@ -1791,11 +1802,11 @@ dependencies = [
|
|||
"style 0.0.1",
|
||||
"time 0.1.34 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"unicase 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"util 0.0.1",
|
||||
"uuid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"webrender_traits 0.1.0 (git+https://github.com/servo/webrender_traits)",
|
||||
"websocket 0.16.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"websocket 0.17.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"xml5ever 0.1.1 (git+https://github.com/Ygg01/xml5ever)",
|
||||
]
|
||||
|
||||
|
@ -1806,7 +1817,7 @@ dependencies = [
|
|||
"msg 0.0.1",
|
||||
"plugins 0.0.1",
|
||||
"script 0.0.1",
|
||||
"url 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"util 0.0.1",
|
||||
]
|
||||
|
||||
|
@ -1832,7 +1843,7 @@ dependencies = [
|
|||
"serde_macros 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"style_traits 0.0.1",
|
||||
"time 0.1.34 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"util 0.0.1",
|
||||
]
|
||||
|
||||
|
@ -2047,7 +2058,7 @@ dependencies = [
|
|||
"string_cache 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"style_traits 0.0.1",
|
||||
"time 0.1.34 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"util 0.0.1",
|
||||
]
|
||||
|
||||
|
@ -2064,7 +2075,7 @@ dependencies = [
|
|||
"string_cache 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"style 0.0.1",
|
||||
"style_traits 0.0.1",
|
||||
"url 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"util 0.0.1",
|
||||
]
|
||||
|
||||
|
@ -2083,7 +2094,7 @@ dependencies = [
|
|||
"selectors 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_macros 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"util 0.0.1",
|
||||
]
|
||||
|
||||
|
@ -2202,18 +2213,16 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "url"
|
||||
version = "0.5.9"
|
||||
version = "1.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"encoding 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"heapsize 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"heapsize_plugin 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"idna 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"matches 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"unicode-bidi 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"unicode-normalization 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"uuid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -2263,7 +2272,7 @@ dependencies = [
|
|||
"serde_macros 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"smallvec 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"string_cache 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -2343,10 +2352,10 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "webdriver"
|
||||
version = "0.8.0"
|
||||
version = "0.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"hyper 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"hyper 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"regex 0.1.55 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -2357,7 +2366,7 @@ name = "webdriver_server"
|
|||
version = "0.0.1"
|
||||
dependencies = [
|
||||
"compositing 0.0.1",
|
||||
"hyper 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"hyper 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"image 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"ipc-channel 0.2.2 (git+https://github.com/servo/ipc-channel)",
|
||||
"log 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -2365,10 +2374,10 @@ dependencies = [
|
|||
"plugins 0.0.1",
|
||||
"regex 0.1.55 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"util 0.0.1",
|
||||
"uuid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"webdriver 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"webdriver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -2412,18 +2421,18 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "websocket"
|
||||
version = "0.16.2"
|
||||
version = "0.17.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"bitflags 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"byteorder 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"hyper 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"hyper 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"net2 0.2.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"openssl 0.7.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"unicase 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
|
@ -171,4 +171,4 @@ bitflags = "0.3"
|
|||
env_logger = "0.3"
|
||||
euclid = {version = "0.6.4", features = ["plugins"]}
|
||||
libc = "0.2"
|
||||
url = {version = "0.5.7", features = ["heap_size", "serde_serialization", "query_encoding"]}
|
||||
url = {version = "1.0.0", features = ["heap_size", "serde", "query_encoding"]}
|
||||
|
|
|
@ -42,4 +42,4 @@ serde_macros = "0.7"
|
|||
smallvec = "0.1"
|
||||
string_cache = {version = "0.2.12", features = ["heap_size"]}
|
||||
time = "0.1"
|
||||
url = {version = "0.5.7", features = ["heap_size"]}
|
||||
url = {version = "1.0.0", features = ["heap_size"]}
|
||||
|
|
|
@ -42,7 +42,7 @@ lazy_static! {
|
|||
Ok(res) => {
|
||||
let ua_stylesheet = Stylesheet::from_bytes(
|
||||
&res,
|
||||
Url::parse(&format!("chrome:///{:?}", filename)).unwrap(),
|
||||
Url::parse(&format!("chrome://resources/{:?}", filename)).unwrap(),
|
||||
None,
|
||||
None,
|
||||
Origin::UserAgent,
|
||||
|
@ -69,7 +69,7 @@ lazy_static! {
|
|||
Ok(res) => {
|
||||
Stylesheet::from_bytes(
|
||||
&res,
|
||||
Url::parse("chrome:///quirks-mode.css").unwrap(),
|
||||
Url::parse("chrome://resources/quirks-mode.css").unwrap(),
|
||||
None,
|
||||
None,
|
||||
Origin::UserAgent,
|
||||
|
|
|
@ -25,4 +25,4 @@ rustc-serialize = "0.3"
|
|||
selectors = {version = "0.5", features = ["heap_size"]}
|
||||
serde = "0.7"
|
||||
serde_macros = "0.7"
|
||||
url = {version = "0.5.7", features = ["heap_size"]}
|
||||
url = {version = "1.0.0", features = ["heap_size"]}
|
||||
|
|
|
@ -45,7 +45,7 @@ serde = "0.7"
|
|||
serde_macros = "0.7"
|
||||
smallvec = "0.1"
|
||||
string_cache = {version = "0.2.12", features = ["heap_size"]}
|
||||
url = {version = "0.5.7", features = ["heap_size", "serde_serialization"]}
|
||||
url = {version = "1.0.0", features = ["heap_size", "serde"]}
|
||||
|
||||
[target.x86_64-pc-windows-gnu.dependencies]
|
||||
kernel32-sys = "0.2"
|
||||
|
|
|
@ -26,9 +26,9 @@ git = "https://github.com/servo/ipc-channel"
|
|||
[dependencies]
|
||||
image = "0.9"
|
||||
log = "0.3.5"
|
||||
hyper = "0.8"
|
||||
hyper = "0.9"
|
||||
rustc-serialize = "0.3.4"
|
||||
regex = "0.1.55"
|
||||
url = {version = "0.5.7", features = ["heap_size"]}
|
||||
url = {version = "1.0.0", features = ["heap_size"]}
|
||||
uuid = { version = "0.2", features = ["v4"] }
|
||||
webdriver = "0.8"
|
||||
webdriver = "0.9"
|
||||
|
|
|
@ -353,7 +353,7 @@ impl Handler {
|
|||
|
||||
let url = receiver.recv().unwrap();
|
||||
|
||||
Ok(WebDriverResponse::Generic(ValueResponse::new(url.serialize().to_json())))
|
||||
Ok(WebDriverResponse::Generic(ValueResponse::new(url.as_str().to_json())))
|
||||
}
|
||||
|
||||
fn handle_window_size(&self) -> WebDriverResult<WebDriverResponse> {
|
||||
|
|
|
@ -27,7 +27,7 @@ dependencies = [
|
|||
"servo 0.0.1",
|
||||
"style 0.0.1",
|
||||
"style_traits 0.0.1",
|
||||
"url 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"util 0.0.1",
|
||||
"x11 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
@ -278,7 +278,7 @@ dependencies = [
|
|||
"serde_macros 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"style_traits 0.0.1",
|
||||
"time 0.1.34 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"util 0.0.1",
|
||||
"webrender 0.1.0 (git+https://github.com/servo/webrender)",
|
||||
"webrender_traits 0.1.0 (git+https://github.com/servo/webrender_traits)",
|
||||
|
@ -286,13 +286,13 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "cookie"
|
||||
version = "0.2.2"
|
||||
version = "0.2.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"openssl 0.7.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"time 0.1.34 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -371,7 +371,7 @@ name = "devtools"
|
|||
version = "0.0.1"
|
||||
dependencies = [
|
||||
"devtools_traits 0.0.1",
|
||||
"hyper 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"hyper 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"ipc-channel 0.2.2 (git+https://github.com/servo/ipc-channel)",
|
||||
"msg 0.0.1",
|
||||
"plugins 0.0.1",
|
||||
|
@ -389,14 +389,14 @@ dependencies = [
|
|||
"bitflags 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"heapsize 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"heapsize_plugin 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"hyper 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"hyper 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"ipc-channel 0.2.2 (git+https://github.com/servo/ipc-channel)",
|
||||
"msg 0.0.1",
|
||||
"plugins 0.0.1",
|
||||
"serde 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_macros 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"time 0.1.34 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -631,7 +631,7 @@ dependencies = [
|
|||
"style_traits 0.0.1",
|
||||
"time 0.1.34 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"unicode-script 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"util 0.0.1",
|
||||
"webrender_traits 0.1.0 (git+https://github.com/servo/webrender_traits)",
|
||||
]
|
||||
|
@ -698,7 +698,7 @@ dependencies = [
|
|||
"servo-egl 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"servo-glutin 0.4.15 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"style_traits 0.0.1",
|
||||
"url 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"util 0.0.1",
|
||||
"x11 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
@ -803,10 +803,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
|
||||
[[package]]
|
||||
name = "hyper"
|
||||
version = "0.8.0"
|
||||
version = "0.9.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"cookie 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cookie 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"httparse 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"language-tags 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -820,7 +820,17 @@ dependencies = [
|
|||
"traitobject 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"typeable 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"unicase 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "idna"
|
||||
version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"matches 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"unicode-bidi 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"unicode-normalization 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -982,7 +992,7 @@ dependencies = [
|
|||
"time 0.1.34 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"unicode-bidi 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"unicode-script 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"util 0.0.1",
|
||||
"webrender_traits 0.1.0 (git+https://github.com/servo/webrender_traits)",
|
||||
]
|
||||
|
@ -999,7 +1009,7 @@ dependencies = [
|
|||
"script_traits 0.0.1",
|
||||
"serde 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_macros 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"util 0.0.1",
|
||||
"webrender_traits 0.1.0 (git+https://github.com/servo/webrender_traits)",
|
||||
]
|
||||
|
@ -1156,14 +1166,14 @@ dependencies = [
|
|||
"euclid 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"heapsize 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"heapsize_plugin 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"hyper 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"hyper 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"ipc-channel 0.2.2 (git+https://github.com/servo/ipc-channel)",
|
||||
"layers 0.2.4 (git+https://github.com/servo/rust-layers)",
|
||||
"plugins 0.0.1",
|
||||
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_macros 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"util 0.0.1",
|
||||
"webrender_traits 0.1.0 (git+https://github.com/servo/webrender_traits)",
|
||||
]
|
||||
|
@ -1173,13 +1183,14 @@ name = "net"
|
|||
version = "0.0.1"
|
||||
dependencies = [
|
||||
"brotli 0.3.20 (git+https://github.com/ende76/brotli-rs)",
|
||||
"cookie 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cookie 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"devtools_traits 0.0.1",
|
||||
"flate2 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"hyper 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"hyper 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"immeta 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"ipc-channel 0.2.2 (git+https://github.com/servo/ipc-channel)",
|
||||
"log 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"matches 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"mime 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"mime_guess 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"msg 0.0.1",
|
||||
|
@ -1191,11 +1202,11 @@ dependencies = [
|
|||
"time 0.1.34 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"tinyfiledialogs 0.1.0 (git+https://github.com/jdm/tinyfiledialogs)",
|
||||
"unicase 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"util 0.0.1",
|
||||
"uuid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"webrender_traits 0.1.0 (git+https://github.com/servo/webrender_traits)",
|
||||
"websocket 0.16.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"websocket 0.17.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1216,7 +1227,7 @@ version = "0.0.1"
|
|||
dependencies = [
|
||||
"heapsize 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"heapsize_plugin 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"hyper 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"hyper 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"image 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"ipc-channel 0.2.2 (git+https://github.com/servo/ipc-channel)",
|
||||
"lazy_static 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -1225,9 +1236,9 @@ dependencies = [
|
|||
"plugins 0.0.1",
|
||||
"serde 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_macros 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"util 0.0.1",
|
||||
"websocket 0.16.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"websocket 0.17.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1631,7 +1642,7 @@ dependencies = [
|
|||
"heapsize 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"heapsize_plugin 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"html5ever 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"hyper 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"hyper 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"image 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"ipc-channel 0.2.2 (git+https://github.com/servo/ipc-channel)",
|
||||
"js 0.1.2 (git+https://github.com/servo/rust-mozjs)",
|
||||
|
@ -1659,11 +1670,11 @@ dependencies = [
|
|||
"style 0.0.1",
|
||||
"time 0.1.34 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"unicase 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"util 0.0.1",
|
||||
"uuid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"webrender_traits 0.1.0 (git+https://github.com/servo/webrender_traits)",
|
||||
"websocket 0.16.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"websocket 0.17.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"xml5ever 0.1.1 (git+https://github.com/Ygg01/xml5ever)",
|
||||
]
|
||||
|
||||
|
@ -1689,7 +1700,7 @@ dependencies = [
|
|||
"serde_macros 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"style_traits 0.0.1",
|
||||
"time 0.1.34 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"util 0.0.1",
|
||||
]
|
||||
|
||||
|
@ -1776,7 +1787,7 @@ dependencies = [
|
|||
"script 0.0.1",
|
||||
"script_traits 0.0.1",
|
||||
"style 0.0.1",
|
||||
"url 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"util 0.0.1",
|
||||
"webdriver_server 0.0.1",
|
||||
"webrender 0.1.0 (git+https://github.com/servo/webrender)",
|
||||
|
@ -1941,7 +1952,7 @@ dependencies = [
|
|||
"string_cache 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"style_traits 0.0.1",
|
||||
"time 0.1.34 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"util 0.0.1",
|
||||
]
|
||||
|
||||
|
@ -1960,7 +1971,7 @@ dependencies = [
|
|||
"selectors 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_macros 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"util 0.0.1",
|
||||
]
|
||||
|
||||
|
@ -2079,18 +2090,16 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "url"
|
||||
version = "0.5.9"
|
||||
version = "1.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"encoding 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"heapsize 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"heapsize_plugin 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"idna 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"matches 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"unicode-bidi 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"unicode-normalization 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"uuid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -2140,7 +2149,7 @@ dependencies = [
|
|||
"serde_macros 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"smallvec 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"string_cache 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -2209,10 +2218,10 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "webdriver"
|
||||
version = "0.8.0"
|
||||
version = "0.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"hyper 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"hyper 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"regex 0.1.55 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -2223,7 +2232,7 @@ name = "webdriver_server"
|
|||
version = "0.0.1"
|
||||
dependencies = [
|
||||
"compositing 0.0.1",
|
||||
"hyper 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"hyper 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"image 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"ipc-channel 0.2.2 (git+https://github.com/servo/ipc-channel)",
|
||||
"log 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -2231,10 +2240,10 @@ dependencies = [
|
|||
"plugins 0.0.1",
|
||||
"regex 0.1.55 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"util 0.0.1",
|
||||
"uuid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"webdriver 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"webdriver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -2278,18 +2287,18 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "websocket"
|
||||
version = "0.16.2"
|
||||
version = "0.17.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"bitflags 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"byteorder 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"hyper 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"hyper 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"net2 0.2.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"openssl 0.7.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"unicase 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
|
@ -19,7 +19,7 @@ codegen-units = 4
|
|||
euclid = {version = "0.6.4", features = ["plugins"]}
|
||||
gleam = "0.2.8"
|
||||
libc = "0.2"
|
||||
url = {version = "0.5.7", features = ["heap_size"]}
|
||||
url = {version = "1.0.0", features = ["heap_size"]}
|
||||
|
||||
[dependencies.servo]
|
||||
path = "../../components/servo"
|
||||
|
|
|
@ -17,7 +17,7 @@ dependencies = [
|
|||
"smallvec 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"string_cache 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"style 0.0.1",
|
||||
"url 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"util 0.0.1",
|
||||
]
|
||||
|
||||
|
@ -188,6 +188,16 @@ name = "heapsize_plugin"
|
|||
version = "0.1.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "idna"
|
||||
version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"matches 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"unicode-bidi 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"unicode-normalization 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ipc-channel"
|
||||
version = "0.2.2"
|
||||
|
@ -458,7 +468,7 @@ dependencies = [
|
|||
"string_cache 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"style_traits 0.0.1",
|
||||
"time 0.1.34 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"util 0.0.1",
|
||||
]
|
||||
|
||||
|
@ -477,7 +487,7 @@ dependencies = [
|
|||
"selectors 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_macros 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"util 0.0.1",
|
||||
]
|
||||
|
||||
|
@ -519,18 +529,15 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "url"
|
||||
version = "0.5.9"
|
||||
version = "1.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"encoding 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"heapsize 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"heapsize_plugin 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"idna 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"matches 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"unicode-bidi 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"unicode-normalization 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"uuid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -557,7 +564,7 @@ dependencies = [
|
|||
"serde_macros 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"smallvec 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"string_cache 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
|
@ -23,7 +23,7 @@ num_cpus = "0.2.2"
|
|||
selectors = {version = "0.5", features = ["heap_size", "unstable"]}
|
||||
smallvec = "0.1"
|
||||
string_cache = {version = "0.2.12", features = ["heap_size", "unstable"]}
|
||||
url = {version = "0.5.7", features = ["heap_size", "query_encoding", "serde_serialization"]}
|
||||
url = {version = "1.0.0", features = ["heap_size", "query_encoding", "serde"]}
|
||||
|
||||
[dependencies.log]
|
||||
version = "0.3.5"
|
||||
|
|
|
@ -9,7 +9,7 @@ path = "lib.rs"
|
|||
|
||||
[dependencies]
|
||||
bitflags = "0.4"
|
||||
url = {version = "0.5.7", features = ["heap_size"]}
|
||||
url = {version = "1.0.0", features = ["heap_size"]}
|
||||
gleam = "0.2.8"
|
||||
euclid = {version = "0.6.4", features = ["plugins"]}
|
||||
servo-glutin = "0.4"
|
||||
|
|
|
@ -21,7 +21,7 @@ dependencies = [
|
|||
"servo-egl 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"style_traits 0.0.1",
|
||||
"time 0.1.34 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"util 0.0.1",
|
||||
]
|
||||
|
||||
|
@ -271,7 +271,7 @@ dependencies = [
|
|||
"serde_macros 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"style_traits 0.0.1",
|
||||
"time 0.1.34 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"util 0.0.1",
|
||||
"webrender 0.1.0 (git+https://github.com/servo/webrender)",
|
||||
"webrender_traits 0.1.0 (git+https://github.com/servo/webrender_traits)",
|
||||
|
@ -279,13 +279,13 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "cookie"
|
||||
version = "0.2.2"
|
||||
version = "0.2.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"openssl 0.7.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"time 0.1.34 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -364,7 +364,7 @@ name = "devtools"
|
|||
version = "0.0.1"
|
||||
dependencies = [
|
||||
"devtools_traits 0.0.1",
|
||||
"hyper 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"hyper 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"ipc-channel 0.2.2 (git+https://github.com/servo/ipc-channel)",
|
||||
"msg 0.0.1",
|
||||
"plugins 0.0.1",
|
||||
|
@ -382,14 +382,14 @@ dependencies = [
|
|||
"bitflags 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"heapsize 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"heapsize_plugin 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"hyper 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"hyper 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"ipc-channel 0.2.2 (git+https://github.com/servo/ipc-channel)",
|
||||
"msg 0.0.1",
|
||||
"plugins 0.0.1",
|
||||
"serde 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_macros 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"time 0.1.34 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -634,7 +634,7 @@ dependencies = [
|
|||
"style_traits 0.0.1",
|
||||
"time 0.1.34 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"unicode-script 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"util 0.0.1",
|
||||
"webrender_traits 0.1.0 (git+https://github.com/servo/webrender_traits)",
|
||||
]
|
||||
|
@ -786,10 +786,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
|
||||
[[package]]
|
||||
name = "hyper"
|
||||
version = "0.8.0"
|
||||
version = "0.9.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"cookie 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cookie 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"httparse 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"language-tags 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -803,7 +803,17 @@ dependencies = [
|
|||
"traitobject 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"typeable 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"unicase 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "idna"
|
||||
version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"matches 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"unicode-bidi 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"unicode-normalization 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -965,7 +975,7 @@ dependencies = [
|
|||
"time 0.1.34 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"unicode-bidi 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"unicode-script 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"util 0.0.1",
|
||||
"webrender_traits 0.1.0 (git+https://github.com/servo/webrender_traits)",
|
||||
]
|
||||
|
@ -982,7 +992,7 @@ dependencies = [
|
|||
"script_traits 0.0.1",
|
||||
"serde 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_macros 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"util 0.0.1",
|
||||
"webrender_traits 0.1.0 (git+https://github.com/servo/webrender_traits)",
|
||||
]
|
||||
|
@ -1139,14 +1149,14 @@ dependencies = [
|
|||
"euclid 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"heapsize 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"heapsize_plugin 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"hyper 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"hyper 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"ipc-channel 0.2.2 (git+https://github.com/servo/ipc-channel)",
|
||||
"layers 0.2.4 (git+https://github.com/servo/rust-layers)",
|
||||
"plugins 0.0.1",
|
||||
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_macros 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"util 0.0.1",
|
||||
"webrender_traits 0.1.0 (git+https://github.com/servo/webrender_traits)",
|
||||
]
|
||||
|
@ -1156,13 +1166,14 @@ name = "net"
|
|||
version = "0.0.1"
|
||||
dependencies = [
|
||||
"brotli 0.3.20 (git+https://github.com/ende76/brotli-rs)",
|
||||
"cookie 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cookie 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"devtools_traits 0.0.1",
|
||||
"flate2 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"hyper 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"hyper 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"immeta 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"ipc-channel 0.2.2 (git+https://github.com/servo/ipc-channel)",
|
||||
"log 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"matches 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"mime 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"mime_guess 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"msg 0.0.1",
|
||||
|
@ -1174,11 +1185,11 @@ dependencies = [
|
|||
"time 0.1.34 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"tinyfiledialogs 0.1.0 (git+https://github.com/jdm/tinyfiledialogs)",
|
||||
"unicase 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"util 0.0.1",
|
||||
"uuid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"webrender_traits 0.1.0 (git+https://github.com/servo/webrender_traits)",
|
||||
"websocket 0.16.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"websocket 0.17.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1199,7 +1210,7 @@ version = "0.0.1"
|
|||
dependencies = [
|
||||
"heapsize 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"heapsize_plugin 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"hyper 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"hyper 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"image 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"ipc-channel 0.2.2 (git+https://github.com/servo/ipc-channel)",
|
||||
"lazy_static 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -1208,9 +1219,9 @@ dependencies = [
|
|||
"plugins 0.0.1",
|
||||
"serde 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_macros 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"util 0.0.1",
|
||||
"websocket 0.16.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"websocket 0.17.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1614,7 +1625,7 @@ dependencies = [
|
|||
"heapsize 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"heapsize_plugin 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"html5ever 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"hyper 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"hyper 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"image 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"ipc-channel 0.2.2 (git+https://github.com/servo/ipc-channel)",
|
||||
"js 0.1.2 (git+https://github.com/servo/rust-mozjs)",
|
||||
|
@ -1642,11 +1653,11 @@ dependencies = [
|
|||
"style 0.0.1",
|
||||
"time 0.1.34 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"unicase 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"util 0.0.1",
|
||||
"uuid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"webrender_traits 0.1.0 (git+https://github.com/servo/webrender_traits)",
|
||||
"websocket 0.16.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"websocket 0.17.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"xml5ever 0.1.1 (git+https://github.com/Ygg01/xml5ever)",
|
||||
]
|
||||
|
||||
|
@ -1672,7 +1683,7 @@ dependencies = [
|
|||
"serde_macros 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"style_traits 0.0.1",
|
||||
"time 0.1.34 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"util 0.0.1",
|
||||
]
|
||||
|
||||
|
@ -1758,7 +1769,7 @@ dependencies = [
|
|||
"script 0.0.1",
|
||||
"script_traits 0.0.1",
|
||||
"style 0.0.1",
|
||||
"url 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"util 0.0.1",
|
||||
"webrender 0.1.0 (git+https://github.com/servo/webrender)",
|
||||
"webrender_traits 0.1.0 (git+https://github.com/servo/webrender_traits)",
|
||||
|
@ -1922,7 +1933,7 @@ dependencies = [
|
|||
"string_cache 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"style_traits 0.0.1",
|
||||
"time 0.1.34 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"util 0.0.1",
|
||||
]
|
||||
|
||||
|
@ -1941,7 +1952,7 @@ dependencies = [
|
|||
"selectors 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_macros 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"util 0.0.1",
|
||||
]
|
||||
|
||||
|
@ -2060,18 +2071,16 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "url"
|
||||
version = "0.5.9"
|
||||
version = "1.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"encoding 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"heapsize 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"heapsize_plugin 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"idna 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"matches 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"unicode-bidi 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"unicode-normalization 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"uuid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -2121,7 +2130,7 @@ dependencies = [
|
|||
"serde_macros 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"smallvec 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"string_cache 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -2229,18 +2238,18 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "websocket"
|
||||
version = "0.16.2"
|
||||
version = "0.17.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"bitflags 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"byteorder 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"hyper 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"hyper 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"net2 0.2.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"openssl 0.7.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"unicase 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
|
@ -49,7 +49,7 @@ features = ["non-geckolib"]
|
|||
|
||||
[dependencies]
|
||||
env_logger = "0.3"
|
||||
url = {version = "0.5.7", features = ["heap_size"]}
|
||||
url = {version = "1.0.0", features = ["heap_size"]}
|
||||
time = "0.1.17"
|
||||
errno = "0.1"
|
||||
libc = "0.2"
|
||||
|
|
|
@ -3,6 +3,6 @@
|
|||
<title>Certificate error</title>
|
||||
</head>
|
||||
<body>
|
||||
<img src="chrome://badcert.jpg">
|
||||
<img src="chrome://resources/badcert.jpg">
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -31,8 +31,8 @@ git = "https://github.com/servo/ipc-channel"
|
|||
|
||||
[dependencies]
|
||||
cookie = "0.2"
|
||||
hyper = "0.8"
|
||||
url = {version = "0.5.7", features = ["heap_size"]}
|
||||
hyper = "0.9"
|
||||
url = {version = "1.0.0", features = ["heap_size"]}
|
||||
time = "0.1"
|
||||
flate2 = "0.2.0"
|
||||
unicase = "1.0"
|
||||
|
|
|
@ -5,42 +5,40 @@
|
|||
use net::chrome_loader::resolve_chrome_url;
|
||||
use url::Url;
|
||||
|
||||
#[test]
|
||||
fn test_relative() {
|
||||
let url = Url::parse("chrome://../something").unwrap();
|
||||
assert!(resolve_chrome_url(&url).is_err());
|
||||
fn c(s: &str) -> Result<Url, ()> {
|
||||
resolve_chrome_url(&Url::parse(s).unwrap())
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_relative_2() {
|
||||
let url = Url::parse("chrome://subdir/../something").unwrap();
|
||||
assert!(resolve_chrome_url(&url).is_err());
|
||||
}
|
||||
fn test_resolve_chrome_url() {
|
||||
assert_eq!(c("chrome://resources/nonexistent.jpg"), Err(()));
|
||||
assert_eq!(c("chrome://not-resources/badcert.jpg"), Err(()));
|
||||
assert_eq!(c("chrome://resources/badcert.jpg").unwrap().scheme(), "file");
|
||||
assert_eq!(c("chrome://resources/subdir/../badcert.jpg").unwrap().scheme(), "file");
|
||||
assert_eq!(c("chrome://resources/subdir/../../badcert.jpg").unwrap().scheme(), "file");
|
||||
assert_eq!(c("chrome://resources/../badcert.jpg").unwrap().scheme(), "file");
|
||||
assert_eq!(c("chrome://resources/../README.md"), Err(()));
|
||||
assert_eq!(c("chrome://resources/%2e%2e/README.md"), Err(()));
|
||||
|
||||
#[test]
|
||||
#[cfg(not(target_os = "windows"))]
|
||||
fn test_absolute() {
|
||||
let url = Url::parse("chrome:///etc/passwd").unwrap();
|
||||
assert!(resolve_chrome_url(&url).is_err());
|
||||
}
|
||||
assert_eq!(c("chrome://resources/etc/passwd"), Err(()));
|
||||
assert_eq!(c("chrome://resources//etc/passwd"), Err(()));
|
||||
assert_eq!(c("chrome://resources/%2Fetc%2Fpasswd"), Err(()));
|
||||
|
||||
#[test]
|
||||
#[cfg(target_os = "windows")]
|
||||
fn test_absolute_2() {
|
||||
let url = Url::parse("chrome://C:\\Windows").unwrap();
|
||||
assert!(resolve_chrome_url(&url).is_err());
|
||||
}
|
||||
assert_eq!(c("chrome://resources/C:/Windows/notepad.exe"), Err(()));
|
||||
assert_eq!(c("chrome://resources/C:\\Windows\\notepad.exe"), Err(()));
|
||||
|
||||
#[test]
|
||||
#[cfg(target_os = "windows")]
|
||||
fn test_absolute_3() {
|
||||
let url = Url::parse("chrome://\\\\server/C$").unwrap();
|
||||
assert!(resolve_chrome_url(&url).is_err());
|
||||
}
|
||||
assert_eq!(c("chrome://resources/localhost/C:/Windows/notepad.exe"), Err(()));
|
||||
assert_eq!(c("chrome://resources//localhost/C:/Windows/notepad.exe"), Err(()));
|
||||
assert_eq!(c("chrome://resources///localhost/C:/Windows/notepad.exe"), Err(()));
|
||||
assert_eq!(c("chrome://resources/\\\\localhost\\C:\\Windows\\notepad.exe"), Err(()));
|
||||
|
||||
#[test]
|
||||
fn test_valid() {
|
||||
let url = Url::parse("chrome://badcert.jpg").unwrap();
|
||||
let resolved = resolve_chrome_url(&url).unwrap();
|
||||
assert_eq!(resolved.scheme, "file");
|
||||
assert_eq!(c("chrome://resources/%3F/C:/Windows/notepad.exe"), Err(()));
|
||||
assert_eq!(c("chrome://resources//%3F/C:/Windows/notepad.exe"), Err(()));
|
||||
assert_eq!(c("chrome://resources///%3F/C:/Windows/notepad.exe"), Err(()));
|
||||
assert_eq!(c("chrome://resources/\\\\%3F\\C:\\Windows\\notepad.exe"), Err(()));
|
||||
|
||||
assert_eq!(c("chrome://resources/%3F/UNC/localhost/C:/Windows/notepad.exe"), Err(()));
|
||||
assert_eq!(c("chrome://resources//%3F/UNC/localhost/C:/Windows/notepad.exe"), Err(()));
|
||||
assert_eq!(c("chrome://resources///%3F/UNC/localhost/C:/Windows/notepad.exe"), Err(()));
|
||||
assert_eq!(c("chrome://resources/\\\\%3F\\UNC\\localhost\\C:\\Windows\\notepad.exe"), Err(()));
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ use std::sync::mpsc::{Sender, channel};
|
|||
use std::sync::{Arc, Mutex};
|
||||
use time::{self, Duration};
|
||||
use unicase::UniCase;
|
||||
use url::{Origin as UrlOrigin, OpaqueOrigin, Url};
|
||||
use url::{Origin as UrlOrigin, Url};
|
||||
|
||||
// TODO write a struct that impls Handler for storing test values
|
||||
|
||||
|
@ -156,7 +156,7 @@ fn test_cors_preflight_fetch() {
|
|||
};
|
||||
let (mut server, url) = make_server(handler);
|
||||
|
||||
let origin = Origin::Origin(UrlOrigin::UID(OpaqueOrigin::new()));
|
||||
let origin = Origin::Origin(UrlOrigin::new_opaque());
|
||||
let mut request = Request::new(url, Some(origin), false);
|
||||
request.referer = Referer::NoReferer;
|
||||
request.use_cors_preflight = true;
|
||||
|
@ -192,7 +192,7 @@ fn test_cors_preflight_fetch_network_error() {
|
|||
};
|
||||
let (mut server, url) = make_server(handler);
|
||||
|
||||
let origin = Origin::Origin(UrlOrigin::UID(OpaqueOrigin::new()));
|
||||
let origin = Origin::Origin(UrlOrigin::new_opaque());
|
||||
let mut request = Request::new(url, Some(origin), false);
|
||||
*request.method.borrow_mut() = Method::Extension("CHICKEN".to_owned());
|
||||
request.referer = Referer::NoReferer;
|
||||
|
@ -269,7 +269,7 @@ fn test_fetch_response_is_cors_filtered() {
|
|||
let (mut server, url) = make_server(handler);
|
||||
|
||||
// an origin mis-match will stop it from defaulting to a basic filtered response
|
||||
let origin = Origin::Origin(UrlOrigin::UID(OpaqueOrigin::new()));
|
||||
let origin = Origin::Origin(UrlOrigin::new_opaque());
|
||||
let mut request = Request::new(url, Some(origin), false);
|
||||
request.referer = Referer::NoReferer;
|
||||
request.mode = RequestMode::CORSMode;
|
||||
|
@ -304,7 +304,7 @@ fn test_fetch_response_is_opaque_filtered() {
|
|||
let (mut server, url) = make_server(handler);
|
||||
|
||||
// an origin mis-match will fall through to an Opaque filtered response
|
||||
let origin = Origin::Origin(UrlOrigin::UID(OpaqueOrigin::new()));
|
||||
let origin = Origin::Origin(UrlOrigin::new_opaque());
|
||||
let mut request = Request::new(url, Some(origin), false);
|
||||
request.referer = Referer::NoReferer;
|
||||
let wrapped_request = Rc::new(request);
|
||||
|
@ -340,7 +340,7 @@ fn test_fetch_response_is_opaque_redirect_filtered() {
|
|||
RequestUri::AbsolutePath(url) =>
|
||||
url.split("/").collect::<String>().parse::<u32>().unwrap_or(0),
|
||||
RequestUri::AbsoluteUri(url) =>
|
||||
url.path().unwrap().last().unwrap().split("/").collect::<String>().parse::<u32>().unwrap_or(0),
|
||||
url.path_segments().unwrap().next_back().unwrap().parse::<u32>().unwrap_or(0),
|
||||
_ => panic!()
|
||||
};
|
||||
|
||||
|
@ -420,7 +420,7 @@ fn setup_server_and_fetch(message: &'static [u8], redirect_cap: u32) -> Response
|
|||
RequestUri::AbsolutePath(url) =>
|
||||
url.split("/").collect::<String>().parse::<u32>().unwrap_or(0),
|
||||
RequestUri::AbsoluteUri(url) =>
|
||||
url.path().unwrap().last().unwrap().split("/").collect::<String>().parse::<u32>().unwrap_or(0),
|
||||
url.path_segments().unwrap().next_back().unwrap().parse::<u32>().unwrap_or(0),
|
||||
_ => panic!()
|
||||
};
|
||||
|
||||
|
@ -493,7 +493,7 @@ fn test_fetch_redirect_updates_method_runner(tx: Sender<bool>, status_code: Stat
|
|||
RequestUri::AbsolutePath(url) =>
|
||||
url.split("/").collect::<String>().parse::<u32>().unwrap_or(0),
|
||||
RequestUri::AbsoluteUri(url) =>
|
||||
url.path().unwrap().last().unwrap().split("/").collect::<String>().parse::<u32>().unwrap_or(0),
|
||||
url.path_segments().unwrap().next_back().unwrap().parse::<u32>().unwrap_or(0),
|
||||
_ => panic!()
|
||||
};
|
||||
|
||||
|
@ -631,7 +631,7 @@ fn test_opaque_filtered_fetch_async_returns_complete_response() {
|
|||
let (mut server, url) = make_server(handler);
|
||||
|
||||
// an origin mis-match will fall through to an Opaque filtered response
|
||||
let origin = Origin::Origin(UrlOrigin::UID(OpaqueOrigin::new()));
|
||||
let origin = Origin::Origin(UrlOrigin::new_opaque());
|
||||
let mut request = Request::new(url, Some(origin), false);
|
||||
request.referer = Referer::NoReferer;
|
||||
|
||||
|
@ -658,7 +658,7 @@ fn test_opaque_redirect_filtered_fetch_async_returns_complete_response() {
|
|||
RequestUri::AbsolutePath(url) =>
|
||||
url.split("/").collect::<String>().parse::<u32>().unwrap_or(0),
|
||||
RequestUri::AbsoluteUri(url) =>
|
||||
url.path().unwrap().last().unwrap().split("/").collect::<String>().parse::<u32>().unwrap_or(0),
|
||||
url.path_segments().unwrap().last().unwrap().parse::<u32>().unwrap_or(0),
|
||||
_ => panic!()
|
||||
};
|
||||
|
||||
|
|
|
@ -267,7 +267,7 @@ fn test_secure_url_does_not_affect_non_http_schemas() {
|
|||
let url = Url::parse("file://mozilla.org").unwrap();
|
||||
let secure = secure_url(&url);
|
||||
|
||||
assert_eq!(&secure.scheme, "file");
|
||||
assert_eq!(secure.scheme(), "file");
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -275,5 +275,5 @@ fn test_secure_url_forces_an_http_host_in_list_to_https() {
|
|||
let url = Url::parse("http://mozilla.org").unwrap();
|
||||
let secure = secure_url(&url);
|
||||
|
||||
assert_eq!(&secure.scheme, "https");
|
||||
assert_eq!(secure.scheme(), "https");
|
||||
}
|
||||
|
|
|
@ -1091,7 +1091,7 @@ fn test_load_errors_when_there_is_too_many_redirects() {
|
|||
|
||||
fn create(&self, url: Url, _: Method, _: Headers) -> Result<MockRequest, LoadError> {
|
||||
if url.domain().unwrap() == "mozilla.com" {
|
||||
Ok(MockRequest::new(ResponseType::Redirect(format!("{}/1", url.serialize()))))
|
||||
Ok(MockRequest::new(ResponseType::Redirect(format!("{}/1", url))))
|
||||
} else {
|
||||
panic!("unexpected host {:?}", url)
|
||||
}
|
||||
|
@ -1334,13 +1334,13 @@ fn test_redirect_from_x_to_x_provides_x_with_cookie_from_first_response() {
|
|||
type R = MockRequest;
|
||||
|
||||
fn create(&self, url: Url, _: Method, headers: Headers) -> Result<MockRequest, LoadError> {
|
||||
if url.path().unwrap()[0] == "initial" {
|
||||
if url.path_segments().unwrap().next().unwrap() == "initial" {
|
||||
let mut initial_answer_headers = Headers::new();
|
||||
initial_answer_headers.set_raw("set-cookie", vec![b"mozillaIs=theBest; path=/;".to_vec()]);
|
||||
Ok(MockRequest::new(
|
||||
ResponseType::RedirectWithHeaders("http://mozilla.org/subsequent/".to_owned(),
|
||||
initial_answer_headers)))
|
||||
} else if url.path().unwrap()[0] == "subsequent" {
|
||||
} else if url.path_segments().unwrap().next().unwrap() == "subsequent" {
|
||||
let mut expected_subsequent_headers = Headers::new();
|
||||
expected_subsequent_headers.set_raw("Cookie", vec![b"mozillaIs=theBest".to_vec()]);
|
||||
assert_headers_included(&expected_subsequent_headers, &headers);
|
||||
|
|
|
@ -8,9 +8,14 @@ use net_traits::hosts::{parse_hostsfile, host_replacement};
|
|||
use net_traits::{ControlMsg, LoadData, LoadConsumer, LoadContext, NetworkError, ProgressMsg};
|
||||
use std::borrow::ToOwned;
|
||||
use std::collections::HashMap;
|
||||
use std::net::IpAddr;
|
||||
use std::sync::mpsc::channel;
|
||||
use url::Url;
|
||||
|
||||
fn ip(s: &str) -> IpAddr {
|
||||
s.parse().unwrap()
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_exit() {
|
||||
let resource_thread = new_resource_thread("".to_owned(), None);
|
||||
|
@ -37,8 +42,8 @@ fn test_parse_hostsfile() {
|
|||
let mock_hosts_file_content = "127.0.0.1 foo.bar.com\n127.0.0.2 servo.test.server";
|
||||
let hosts_table = parse_hostsfile(mock_hosts_file_content);
|
||||
assert_eq!(2, hosts_table.len());
|
||||
assert_eq!("127.0.0.1".to_owned(), *hosts_table.get(&"foo.bar.com".to_owned()).unwrap());
|
||||
assert_eq!("127.0.0.2".to_owned(), *hosts_table.get(&"servo.test.server".to_owned()).unwrap());
|
||||
assert_eq!(ip("127.0.0.1"), *hosts_table.get("foo.bar.com").unwrap());
|
||||
assert_eq!(ip("127.0.0.2"), *hosts_table.get("servo.test.server").unwrap());
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -46,7 +51,7 @@ fn test_parse_malformed_hostsfile() {
|
|||
let mock_hosts_file_content = "malformed file\n127.0.0.1 foo.bar.com\nservo.test.server 127.0.0.1";
|
||||
let hosts_table = parse_hostsfile(mock_hosts_file_content);
|
||||
assert_eq!(1, hosts_table.len());
|
||||
assert_eq!("127.0.0.1".to_owned(), *hosts_table.get(&"foo.bar.com".to_owned()).unwrap());
|
||||
assert_eq!(ip("127.0.0.1"), *hosts_table.get("foo.bar.com").unwrap());
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -54,7 +59,7 @@ fn test_parse_hostsfile_with_line_comment() {
|
|||
let mock_hosts_file_content = "# this is a line comment\n127.0.0.1 foo.bar.com\n# anothercomment";
|
||||
let hosts_table = parse_hostsfile(mock_hosts_file_content);
|
||||
assert_eq!(1, hosts_table.len());
|
||||
assert_eq!("127.0.0.1".to_owned(), *hosts_table.get(&"foo.bar.com".to_owned()).unwrap());
|
||||
assert_eq!(ip("127.0.0.1"), *hosts_table.get("foo.bar.com").unwrap());
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -62,8 +67,8 @@ fn test_parse_hostsfile_with_end_of_line_comment() {
|
|||
let mock_hosts_file_content = "127.0.0.1 foo.bar.com # line ending comment\n127.0.0.2 servo.test.server #comment";
|
||||
let hosts_table = parse_hostsfile(mock_hosts_file_content);
|
||||
assert_eq!(2, hosts_table.len());
|
||||
assert_eq!("127.0.0.1".to_owned(), *hosts_table.get(&"foo.bar.com".to_owned()).unwrap());
|
||||
assert_eq!("127.0.0.2".to_owned(), *hosts_table.get(&"servo.test.server".to_owned()).unwrap());
|
||||
assert_eq!(ip("127.0.0.1"), *hosts_table.get("foo.bar.com").unwrap());
|
||||
assert_eq!(ip("127.0.0.2"), *hosts_table.get("servo.test.server").unwrap());
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -71,8 +76,8 @@ fn test_parse_hostsfile_with_2_hostnames_for_1_address() {
|
|||
let mock_hosts_file_content = "127.0.0.1 foo.bar.com baz.bar.com";
|
||||
let hosts_table = parse_hostsfile(mock_hosts_file_content);
|
||||
assert_eq!(2, hosts_table.len());
|
||||
assert_eq!("127.0.0.1".to_owned(), *hosts_table.get(&"foo.bar.com".to_owned()).unwrap());
|
||||
assert_eq!("127.0.0.1".to_owned(), *hosts_table.get(&"baz.bar.com".to_owned()).unwrap());
|
||||
assert_eq!(ip("127.0.0.1"), *hosts_table.get("foo.bar.com").unwrap());
|
||||
assert_eq!(ip("127.0.0.1"), *hosts_table.get("baz.bar.com").unwrap());
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -80,10 +85,10 @@ fn test_parse_hostsfile_with_4_hostnames_for_1_address() {
|
|||
let mock_hosts_file_content = "127.0.0.1 moz.foo.com moz.bar.com moz.baz.com moz.moz.com";
|
||||
let hosts_table = parse_hostsfile(mock_hosts_file_content);
|
||||
assert_eq!(4, hosts_table.len());
|
||||
assert_eq!("127.0.0.1".to_owned(), *hosts_table.get(&"moz.foo.com".to_owned()).unwrap());
|
||||
assert_eq!("127.0.0.1".to_owned(), *hosts_table.get(&"moz.bar.com".to_owned()).unwrap());
|
||||
assert_eq!("127.0.0.1".to_owned(), *hosts_table.get(&"moz.baz.com".to_owned()).unwrap());
|
||||
assert_eq!("127.0.0.1".to_owned(), *hosts_table.get(&"moz.moz.com".to_owned()).unwrap());
|
||||
assert_eq!(ip("127.0.0.1"), *hosts_table.get("moz.foo.com").unwrap());
|
||||
assert_eq!(ip("127.0.0.1"), *hosts_table.get("moz.bar.com").unwrap());
|
||||
assert_eq!(ip("127.0.0.1"), *hosts_table.get("moz.baz.com").unwrap());
|
||||
assert_eq!(ip("127.0.0.1"), *hosts_table.get("moz.moz.com").unwrap());
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -91,8 +96,8 @@ fn test_parse_hostsfile_with_tabs_instead_spaces() {
|
|||
let mock_hosts_file_content = "127.0.0.1\tfoo.bar.com\n127.0.0.2\tservo.test.server";
|
||||
let hosts_table = parse_hostsfile(mock_hosts_file_content);
|
||||
assert_eq!(2, hosts_table.len());
|
||||
assert_eq!("127.0.0.1".to_owned(), *hosts_table.get(&"foo.bar.com".to_owned()).unwrap());
|
||||
assert_eq!("127.0.0.2".to_owned(), *hosts_table.get(&"servo.test.server".to_owned()).unwrap());
|
||||
assert_eq!(ip("127.0.0.1"), *hosts_table.get("foo.bar.com").unwrap());
|
||||
assert_eq!(ip("127.0.0.2"), *hosts_table.get("servo.test.server").unwrap());
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -145,25 +150,25 @@ fn test_parse_hostsfile_with_end_of_line_whitespace()
|
|||
127.0.0.2 servo.test.server ";
|
||||
let hosts_table = parse_hostsfile(mock_hosts_file_content);
|
||||
assert_eq!(3, hosts_table.len());
|
||||
assert_eq!("127.0.0.1".to_owned(), *hosts_table.get(&"foo.bar.com".to_owned()).unwrap());
|
||||
assert_eq!("2001:db8:0:0:0:ff00:42:8329".to_owned(), *hosts_table.get(&"moz.foo.com".to_owned()).unwrap());
|
||||
assert_eq!("127.0.0.2".to_owned(), *hosts_table.get(&"servo.test.server".to_owned()).unwrap());
|
||||
assert_eq!(ip("127.0.0.1"), *hosts_table.get("foo.bar.com").unwrap());
|
||||
assert_eq!(ip("2001:db8:0:0:0:ff00:42:8329"), *hosts_table.get("moz.foo.com").unwrap());
|
||||
assert_eq!(ip("127.0.0.2"), *hosts_table.get("servo.test.server").unwrap());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_replace_hosts() {
|
||||
let mut host_table = HashMap::new();
|
||||
host_table.insert("foo.bar.com".to_owned(), "127.0.0.1".to_owned());
|
||||
host_table.insert("servo.test.server".to_owned(), "127.0.0.2".to_owned());
|
||||
host_table.insert("foo.bar.com".to_owned(), ip("127.0.0.1"));
|
||||
host_table.insert("servo.test.server".to_owned(), ip("127.0.0.2"));
|
||||
|
||||
let url = Url::parse("http://foo.bar.com:8000/foo").unwrap();
|
||||
assert_eq!(host_replacement(&host_table, &url).domain().unwrap(), "127.0.0.1");
|
||||
assert_eq!(host_replacement(&host_table, &url).host_str().unwrap(), "127.0.0.1");
|
||||
|
||||
let url = Url::parse("http://servo.test.server").unwrap();
|
||||
assert_eq!(host_replacement(&host_table, &url).domain().unwrap(), "127.0.0.2");
|
||||
assert_eq!(host_replacement(&host_table, &url).host_str().unwrap(), "127.0.0.2");
|
||||
|
||||
let url = Url::parse("http://a.foo.bar.com").unwrap();
|
||||
assert_eq!(host_replacement(&host_table, &url).domain().unwrap(), "a.foo.bar.com");
|
||||
assert_eq!(host_replacement(&host_table, &url).host_str().unwrap(), "a.foo.bar.com");
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
|
@ -21,4 +21,4 @@ path = "../../../components/script"
|
|||
path = "../../../components/util"
|
||||
|
||||
[dependencies]
|
||||
url = {version = "0.5.8", features = ["heap_size"]}
|
||||
url = {version = "1.0.0", features = ["heap_size"]}
|
||||
|
|
|
@ -29,4 +29,4 @@ cssparser = {version = "0.5.4", features = ["heap_size"]}
|
|||
euclid = {version = "0.6.4", features = ["plugins"]}
|
||||
selectors = {version = "0.5", features = ["heap_size"]}
|
||||
string_cache = {version = "0.2.12", features = ["heap_size"]}
|
||||
url = {version = "0.5.7", features = ["heap_size"]}
|
||||
url = {version = "1.0.0", features = ["heap_size"]}
|
||||
|
|
|
@ -17,11 +17,11 @@ fn test_argument_parsing() {
|
|||
assert!(parse_url_or_filename(fake_cwd, "http://example.net:invalid").is_err());
|
||||
|
||||
let url = parse_url_or_filename(fake_cwd, "http://example.net").unwrap();
|
||||
assert_eq!(url.scheme, "http");
|
||||
assert_eq!(url.scheme(), "http");
|
||||
|
||||
let url = parse_url_or_filename(fake_cwd, "file:///foo/bar.html").unwrap();
|
||||
assert_eq!(url.scheme, "file");
|
||||
assert_eq!(url.path().unwrap(), ["foo", "bar.html"]);
|
||||
assert_eq!(url.scheme(), "file");
|
||||
assert_eq!(url.path_segments().unwrap().collect::<Vec<_>>(), ["foo", "bar.html"]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -30,8 +30,8 @@ fn test_file_path_parsing() {
|
|||
let fake_cwd = Path::new(FAKE_CWD);
|
||||
|
||||
let url = parse_url_or_filename(fake_cwd, "bar.html").unwrap();
|
||||
assert_eq!(url.scheme, "file");
|
||||
assert_eq!(url.path().unwrap(), ["fake", "cwd", "bar.html"]);
|
||||
assert_eq!(url.scheme(), "file");
|
||||
assert_eq!(url.path_segments().unwrap().collect::<Vec<_>>(), ["fake", "cwd", "bar.html"]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -40,8 +40,8 @@ fn test_file_path_parsing() {
|
|||
let fake_cwd = Path::new(FAKE_CWD);
|
||||
|
||||
let url = parse_url_or_filename(fake_cwd, "bar.html").unwrap();
|
||||
assert_eq!(url.scheme, "file");
|
||||
assert_eq!(url.path().unwrap(), ["C:", "fake", "cwd", "bar.html"]);
|
||||
assert_eq!(url.scheme(), "file");
|
||||
assert_eq!(url.path_segments().unwrap().collect::<Vec<_>>(), ["C:", "fake", "cwd", "bar.html"]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -53,16 +53,17 @@ fn test_argument_parsing_special() {
|
|||
// '?' and '#' have a special meaning in URLs...
|
||||
let url = parse_url_or_filename(fake_cwd, "file:///foo/bar?baz#buzz.html").unwrap();
|
||||
assert_eq!(&*url.to_file_path().unwrap(), Path::new("/foo/bar"));
|
||||
assert_eq!(url.scheme, "file");
|
||||
assert_eq!(url.path().unwrap(), ["foo", "bar"]);
|
||||
assert_eq!(url.query.unwrap(), "baz");
|
||||
assert_eq!(url.fragment.unwrap(), "buzz.html");
|
||||
assert_eq!(url.scheme(), "file");
|
||||
assert_eq!(url.path_segments().unwrap().collect::<Vec<_>>(), ["foo", "bar"]);
|
||||
assert_eq!(url.query(), Some("baz"));
|
||||
assert_eq!(url.fragment(), Some("buzz.html"));
|
||||
|
||||
// but not in file names.
|
||||
let url = parse_url_or_filename(fake_cwd, "./bar?baz#buzz.html").unwrap();
|
||||
assert_eq!(&*url.to_file_path().unwrap(), Path::new("/fake/cwd/bar?baz#buzz.html"));
|
||||
assert_eq!(url.scheme, "file");
|
||||
assert_eq!(url.path().unwrap(), ["fake", "cwd", "bar%3Fbaz%23buzz.html"]);
|
||||
assert!(url.query.is_none());
|
||||
assert!(url.fragment.is_none());
|
||||
assert_eq!(url.scheme(), "file");
|
||||
assert_eq!(url.path_segments().unwrap().collect::<Vec<_>>(),
|
||||
["fake", "cwd", "bar%3Fbaz%23buzz.html"]);
|
||||
assert_eq!(url.query(), None);
|
||||
assert_eq!(url.fragment(), None);
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче