mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Use Url.join instead of UrlParser.base_url(...).parse (#9002)
This commit is contained in:
parent
6764cf0ee9
commit
11234f5370
41 changed files with 58 additions and 64 deletions
|
@ -78,7 +78,7 @@ gleam = "0.2"
|
||||||
euclid = {version = "0.4", features = ["plugins"]}
|
euclid = {version = "0.4", features = ["plugins"]}
|
||||||
serde = "0.6"
|
serde = "0.6"
|
||||||
serde_macros = "0.6"
|
serde_macros = "0.6"
|
||||||
url = "0.5"
|
url = "0.5.2"
|
||||||
|
|
||||||
[target.x86_64-apple-darwin.dependencies]
|
[target.x86_64-apple-darwin.dependencies]
|
||||||
core-graphics = "0.2"
|
core-graphics = "0.2"
|
||||||
|
|
|
@ -29,4 +29,4 @@ time = "0.1"
|
||||||
rustc-serialize = "0.3"
|
rustc-serialize = "0.3"
|
||||||
serde = "0.6"
|
serde = "0.6"
|
||||||
serde_macros = "0.6"
|
serde_macros = "0.6"
|
||||||
url = "0.5"
|
url = "0.5.2"
|
||||||
|
|
|
@ -26,5 +26,5 @@ rustc-serialize = "0.3"
|
||||||
bitflags = "0.3"
|
bitflags = "0.3"
|
||||||
serde = "0.6"
|
serde = "0.6"
|
||||||
serde_macros = "0.6"
|
serde_macros = "0.6"
|
||||||
url = "0.5"
|
url = "0.5.2"
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@ smallvec = "0.1"
|
||||||
string_cache = "0.2"
|
string_cache = "0.2"
|
||||||
time = "0.1.12"
|
time = "0.1.12"
|
||||||
unicode-script = { version = "0.1", features = ["harfbuzz"] }
|
unicode-script = { version = "0.1", features = ["harfbuzz"] }
|
||||||
url = "0.5"
|
url = "0.5.2"
|
||||||
servo-skia = "0.20130412.0"
|
servo-skia = "0.20130412.0"
|
||||||
|
|
||||||
[dependencies.plugins]
|
[dependencies.plugins]
|
||||||
|
|
|
@ -75,4 +75,4 @@ serde_json = "0.5"
|
||||||
time = "0.1"
|
time = "0.1"
|
||||||
unicode-bidi = "0.2"
|
unicode-bidi = "0.2"
|
||||||
unicode-script = { version = "0.1", features = ["harfbuzz"] }
|
unicode-script = { version = "0.1", features = ["harfbuzz"] }
|
||||||
url = "0.5"
|
url = "0.5.2"
|
||||||
|
|
|
@ -32,4 +32,4 @@ git = "https://github.com/servo/ipc-channel"
|
||||||
euclid = {version = "0.4", features = ["plugins"]}
|
euclid = {version = "0.4", features = ["plugins"]}
|
||||||
serde = "0.6"
|
serde = "0.6"
|
||||||
serde_macros = "0.6"
|
serde_macros = "0.6"
|
||||||
url = "0.5"
|
url = "0.5.2"
|
||||||
|
|
|
@ -33,7 +33,7 @@ rustc-serialize = "0.3.4"
|
||||||
euclid = {version = "0.4", features = ["plugins"]}
|
euclid = {version = "0.4", features = ["plugins"]}
|
||||||
serde = "0.6"
|
serde = "0.6"
|
||||||
serde_macros = "0.6"
|
serde_macros = "0.6"
|
||||||
url = "0.5"
|
url = "0.5.2"
|
||||||
|
|
||||||
[target.x86_64-apple-darwin.dependencies]
|
[target.x86_64-apple-darwin.dependencies]
|
||||||
core-foundation = "0.2"
|
core-foundation = "0.2"
|
||||||
|
|
|
@ -39,5 +39,5 @@ mime_guess = "1.1.1"
|
||||||
flate2 = "0.2.0"
|
flate2 = "0.2.0"
|
||||||
uuid = "0.1.16"
|
uuid = "0.1.16"
|
||||||
euclid = {version = "0.4", features = ["plugins"]}
|
euclid = {version = "0.4", features = ["plugins"]}
|
||||||
url = "0.5"
|
url = "0.5.2"
|
||||||
websocket = "0.14.0"
|
websocket = "0.14.0"
|
||||||
|
|
|
@ -17,7 +17,7 @@ use std::ascii::AsciiExt;
|
||||||
use std::cell::RefCell;
|
use std::cell::RefCell;
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
use url::{Url, UrlParser};
|
use url::Url;
|
||||||
use util::task::spawn_named;
|
use util::task::spawn_named;
|
||||||
|
|
||||||
/// A [request context](https://fetch.spec.whatwg.org/#concept-request-context)
|
/// A [request context](https://fetch.spec.whatwg.org/#concept-request-context)
|
||||||
|
@ -367,7 +367,7 @@ impl Request {
|
||||||
_ => return Response::network_error(),
|
_ => return Response::network_error(),
|
||||||
};
|
};
|
||||||
// Step 5
|
// Step 5
|
||||||
let location_url = UrlParser::new().base_url(self.url_list.last().unwrap()).parse(&*location);
|
let location_url = self.url_list.last().unwrap().join(&*location);
|
||||||
// Step 6
|
// Step 6
|
||||||
let location_url = match location_url {
|
let location_url = match location_url {
|
||||||
Ok(ref url) if url.scheme == "data" => { return Response::network_error(); }
|
Ok(ref url) if url.scheme == "data" => { return Response::network_error(); }
|
||||||
|
|
|
@ -37,7 +37,7 @@ use std::error::Error;
|
||||||
use std::io::{self, Read, Write};
|
use std::io::{self, Read, Write};
|
||||||
use std::sync::mpsc::Sender;
|
use std::sync::mpsc::Sender;
|
||||||
use std::sync::{Arc, RwLock};
|
use std::sync::{Arc, RwLock};
|
||||||
use url::{Url, UrlParser};
|
use url::Url;
|
||||||
use util::resource_files::resources_dir_path;
|
use util::resource_files::resources_dir_path;
|
||||||
use util::task::spawn_named;
|
use util::task::spawn_named;
|
||||||
use uuid;
|
use uuid;
|
||||||
|
@ -700,7 +700,7 @@ pub fn load<A>(load_data: LoadData,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let new_doc_url = match UrlParser::new().base_url(&doc_url).parse(&new_url) {
|
let new_doc_url = match doc_url.join(&new_url) {
|
||||||
Ok(u) => u,
|
Ok(u) => u,
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
return Err(LoadError::InvalidRedirect(doc_url, e.to_string()));
|
return Err(LoadError::InvalidRedirect(doc_url, e.to_string()));
|
||||||
|
|
|
@ -29,5 +29,5 @@ hyper = { version = "0.7", features = [ "serde-serialization" ] }
|
||||||
image = "0.5.0"
|
image = "0.5.0"
|
||||||
serde = "0.6"
|
serde = "0.6"
|
||||||
serde_macros = "0.6"
|
serde_macros = "0.6"
|
||||||
url = "0.5"
|
url = "0.5.2"
|
||||||
websocket = "0.14.0"
|
websocket = "0.14.0"
|
||||||
|
|
|
@ -17,7 +17,7 @@ branch = "servo"
|
||||||
optional = true
|
optional = true
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
url = "0.5"
|
url = "0.5.2"
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = []
|
default = []
|
||||||
|
|
|
@ -87,5 +87,5 @@ rand = "0.3"
|
||||||
serde = "0.6"
|
serde = "0.6"
|
||||||
caseless = "0.1.0"
|
caseless = "0.1.0"
|
||||||
image = "0.5.0"
|
image = "0.5.0"
|
||||||
url = "0.5"
|
url = "0.5.2"
|
||||||
ref_slice = "0.1.0"
|
ref_slice = "0.1.0"
|
||||||
|
|
|
@ -81,7 +81,6 @@ use style::properties::longhands::{self, background_image, border_spacing, font_
|
||||||
use style::properties::{PropertyDeclaration, PropertyDeclarationBlock, parse_style_attribute};
|
use style::properties::{PropertyDeclaration, PropertyDeclarationBlock, parse_style_attribute};
|
||||||
use style::values::CSSFloat;
|
use style::values::CSSFloat;
|
||||||
use style::values::specified::{self, CSSColor, CSSRGBA, LengthOrPercentage};
|
use style::values::specified::{self, CSSColor, CSSRGBA, LengthOrPercentage};
|
||||||
use url::UrlParser;
|
|
||||||
use util::mem::HeapSizeOf;
|
use util::mem::HeapSizeOf;
|
||||||
use util::str::{DOMString, LengthOrPercentageOrAuto};
|
use util::str::{DOMString, LengthOrPercentageOrAuto};
|
||||||
|
|
||||||
|
@ -1051,7 +1050,7 @@ impl Element {
|
||||||
let base = doc.url();
|
let base = doc.url();
|
||||||
// https://html.spec.whatwg.org/multipage/#reflect
|
// https://html.spec.whatwg.org/multipage/#reflect
|
||||||
// XXXManishearth this doesn't handle `javascript:` urls properly
|
// XXXManishearth this doesn't handle `javascript:` urls properly
|
||||||
match UrlParser::new().base_url(&base).parse(&url) {
|
match base.join(&url) {
|
||||||
Ok(parsed) => DOMString::from(parsed.serialize()),
|
Ok(parsed) => DOMString::from(parsed.serialize()),
|
||||||
Err(_) => DOMString::from(""),
|
Err(_) => DOMString::from(""),
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,6 @@ use dom::virtualmethods::VirtualMethods;
|
||||||
use num::ToPrimitive;
|
use num::ToPrimitive;
|
||||||
use std::default::Default;
|
use std::default::Default;
|
||||||
use string_cache::Atom;
|
use string_cache::Atom;
|
||||||
use url::UrlParser;
|
|
||||||
use util::str::DOMString;
|
use util::str::DOMString;
|
||||||
|
|
||||||
#[dom_struct]
|
#[dom_struct]
|
||||||
|
@ -187,7 +186,7 @@ fn follow_hyperlink(subject: &Element, hyperlink_suffix: Option<String>) {
|
||||||
|
|
||||||
// Step 4-5.
|
// Step 4-5.
|
||||||
let document = document_from_node(subject);
|
let document = document_from_node(subject);
|
||||||
let url = match UrlParser::new().base_url(&document.url()).parse(&href) {
|
let url = match document.url().join(&href) {
|
||||||
Ok(url) => url,
|
Ok(url) => url,
|
||||||
Err(_) => return,
|
Err(_) => return,
|
||||||
};
|
};
|
||||||
|
|
|
@ -12,7 +12,7 @@ use dom::htmlelement::HTMLElement;
|
||||||
use dom::node::{Node, document_from_node};
|
use dom::node::{Node, document_from_node};
|
||||||
use dom::virtualmethods::VirtualMethods;
|
use dom::virtualmethods::VirtualMethods;
|
||||||
use string_cache::Atom;
|
use string_cache::Atom;
|
||||||
use url::{Url, UrlParser};
|
use url::Url;
|
||||||
use util::str::DOMString;
|
use util::str::DOMString;
|
||||||
|
|
||||||
#[dom_struct]
|
#[dom_struct]
|
||||||
|
@ -42,7 +42,7 @@ impl HTMLBaseElement {
|
||||||
that have a base url.");
|
that have a base url.");
|
||||||
let document = document_from_node(self);
|
let document = document_from_node(self);
|
||||||
let base = document.fallback_base_url();
|
let base = document.fallback_base_url();
|
||||||
let parsed = UrlParser::new().base_url(&base).parse(&href.value());
|
let parsed = base.join(&href.value());
|
||||||
parsed.unwrap_or(base)
|
parsed.unwrap_or(base)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@ use script_traits::ScriptMsg as ConstellationMsg;
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
use string_cache::Atom;
|
use string_cache::Atom;
|
||||||
use time;
|
use time;
|
||||||
use url::{Url, UrlParser};
|
use url::Url;
|
||||||
use util::str::DOMString;
|
use util::str::DOMString;
|
||||||
|
|
||||||
/// How long we should wait before performing the initial reflow after `<body>` is parsed, in
|
/// How long we should wait before performing the initial reflow after `<body>` is parsed, in
|
||||||
|
@ -157,7 +157,7 @@ impl VirtualMethods for HTMLBodyElement {
|
||||||
*self.background.borrow_mut() = mutation.new_value(attr).and_then(|value| {
|
*self.background.borrow_mut() = mutation.new_value(attr).and_then(|value| {
|
||||||
let document = document_from_node(self);
|
let document = document_from_node(self);
|
||||||
let base = document.url();
|
let base = document.url();
|
||||||
UrlParser::new().base_url(&base).parse(&value).ok()
|
base.join(&value).ok()
|
||||||
});
|
});
|
||||||
true
|
true
|
||||||
},
|
},
|
||||||
|
|
|
@ -35,7 +35,6 @@ use script_task::{MainThreadScriptMsg, ScriptChan};
|
||||||
use std::borrow::ToOwned;
|
use std::borrow::ToOwned;
|
||||||
use std::cell::Cell;
|
use std::cell::Cell;
|
||||||
use string_cache::Atom;
|
use string_cache::Atom;
|
||||||
use url::UrlParser;
|
|
||||||
use url::form_urlencoded::serialize;
|
use url::form_urlencoded::serialize;
|
||||||
use util::str::DOMString;
|
use util::str::DOMString;
|
||||||
|
|
||||||
|
@ -200,7 +199,7 @@ impl HTMLFormElement {
|
||||||
action = DOMString::from(base.serialize());
|
action = DOMString::from(base.serialize());
|
||||||
}
|
}
|
||||||
// Step 9-11
|
// Step 9-11
|
||||||
let action_components = match UrlParser::new().base_url(base).parse(&action) {
|
let action_components = match base.join(&action) {
|
||||||
Ok(url) => url,
|
Ok(url) => url,
|
||||||
Err(_) => return
|
Err(_) => return
|
||||||
};
|
};
|
||||||
|
|
|
@ -32,7 +32,7 @@ use script_traits::ScriptMsg as ConstellationMsg;
|
||||||
use std::ascii::AsciiExt;
|
use std::ascii::AsciiExt;
|
||||||
use std::cell::Cell;
|
use std::cell::Cell;
|
||||||
use string_cache::Atom;
|
use string_cache::Atom;
|
||||||
use url::{Url, UrlParser};
|
use url::Url;
|
||||||
use util::prefs;
|
use util::prefs;
|
||||||
use util::str::DOMString;
|
use util::str::DOMString;
|
||||||
use util::str::{self, LengthOrPercentageOrAuto};
|
use util::str::{self, LengthOrPercentageOrAuto};
|
||||||
|
@ -74,8 +74,7 @@ impl HTMLIFrameElement {
|
||||||
None
|
None
|
||||||
} else {
|
} else {
|
||||||
let window = window_from_node(self);
|
let window = window_from_node(self);
|
||||||
UrlParser::new().base_url(&window.get_url())
|
window.get_url().join(&url).ok()
|
||||||
.parse(&url).ok()
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,7 @@ use script_task::ScriptTaskEventCategory::UpdateReplacedElement;
|
||||||
use script_task::{CommonScriptMsg, Runnable, ScriptChan};
|
use script_task::{CommonScriptMsg, Runnable, ScriptChan};
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use string_cache::Atom;
|
use string_cache::Atom;
|
||||||
use url::{Url, UrlParser};
|
use url::Url;
|
||||||
use util::str::DOMString;
|
use util::str::DOMString;
|
||||||
|
|
||||||
#[dom_struct]
|
#[dom_struct]
|
||||||
|
@ -101,7 +101,7 @@ impl HTMLImageElement {
|
||||||
*self.image.borrow_mut() = None;
|
*self.image.borrow_mut() = None;
|
||||||
}
|
}
|
||||||
Some((src, base_url)) => {
|
Some((src, base_url)) => {
|
||||||
let img_url = UrlParser::new().base_url(&base_url).parse(&src);
|
let img_url = base_url.join(&src);
|
||||||
// FIXME: handle URL parse errors more gracefully.
|
// FIXME: handle URL parse errors more gracefully.
|
||||||
let img_url = img_url.unwrap();
|
let img_url = img_url.unwrap();
|
||||||
*self.url.borrow_mut() = Some(img_url.clone());
|
*self.url.borrow_mut() = Some(img_url.clone());
|
||||||
|
|
|
@ -37,7 +37,7 @@ use std::sync::{Arc, Mutex};
|
||||||
use string_cache::Atom;
|
use string_cache::Atom;
|
||||||
use style::media_queries::{MediaQueryList, parse_media_query_list};
|
use style::media_queries::{MediaQueryList, parse_media_query_list};
|
||||||
use style::stylesheets::{Origin, Stylesheet};
|
use style::stylesheets::{Origin, Stylesheet};
|
||||||
use url::{Url, UrlParser};
|
use url::Url;
|
||||||
use util::str::{DOMString, HTML_SPACE_CHARACTERS};
|
use util::str::{DOMString, HTML_SPACE_CHARACTERS};
|
||||||
|
|
||||||
no_jsmanaged_fields!(Stylesheet);
|
no_jsmanaged_fields!(Stylesheet);
|
||||||
|
@ -182,7 +182,7 @@ impl HTMLLinkElement {
|
||||||
fn handle_stylesheet_url(&self, href: &str) {
|
fn handle_stylesheet_url(&self, href: &str) {
|
||||||
let window = window_from_node(self);
|
let window = window_from_node(self);
|
||||||
let window = window.r();
|
let window = window.r();
|
||||||
match UrlParser::new().base_url(&window.get_url()).parse(href) {
|
match window.get_url().join(href) {
|
||||||
Ok(url) => {
|
Ok(url) => {
|
||||||
let element = self.upcast::<Element>();
|
let element = self.upcast::<Element>();
|
||||||
|
|
||||||
|
@ -232,7 +232,7 @@ impl HTMLLinkElement {
|
||||||
fn handle_favicon_url(&self, rel: &str, href: &str, sizes: &Option<String>) {
|
fn handle_favicon_url(&self, rel: &str, href: &str, sizes: &Option<String>) {
|
||||||
let window = window_from_node(self);
|
let window = window_from_node(self);
|
||||||
let window = window.r();
|
let window = window.r();
|
||||||
match UrlParser::new().base_url(&window.get_url()).parse(href) {
|
match window.get_url().join(href) {
|
||||||
Ok(url) => {
|
Ok(url) => {
|
||||||
let ConstellationChan(ref chan) = window.constellation_chan();
|
let ConstellationChan(ref chan) = window.constellation_chan();
|
||||||
let event = ConstellationMsg::NewFavicon(url.clone());
|
let event = ConstellationMsg::NewFavicon(url.clone());
|
||||||
|
|
|
@ -41,7 +41,7 @@ use std::cell::Cell;
|
||||||
use std::mem;
|
use std::mem;
|
||||||
use std::sync::{Arc, Mutex};
|
use std::sync::{Arc, Mutex};
|
||||||
use string_cache::Atom;
|
use string_cache::Atom;
|
||||||
use url::{Url, UrlParser};
|
use url::Url;
|
||||||
use util::str::{DOMString, HTML_SPACE_CHARACTERS, StaticStringVec};
|
use util::str::{DOMString, HTML_SPACE_CHARACTERS, StaticStringVec};
|
||||||
|
|
||||||
#[dom_struct]
|
#[dom_struct]
|
||||||
|
@ -263,7 +263,7 @@ impl HTMLScriptElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Step 15.3
|
// Step 15.3
|
||||||
match UrlParser::new().base_url(&base_url).parse(&src) {
|
match base_url.join(&src) {
|
||||||
Err(_) => {
|
Err(_) => {
|
||||||
// Step 15.4
|
// Step 15.4
|
||||||
error!("error parsing URL for script {}", &**src);
|
error!("error parsing URL for script {}", &**src);
|
||||||
|
|
|
@ -10,7 +10,7 @@ use dom::bindings::reflector::{Reflector, reflect_dom_object};
|
||||||
use dom::bindings::str::USVString;
|
use dom::bindings::str::USVString;
|
||||||
use dom::urlhelper::UrlHelper;
|
use dom::urlhelper::UrlHelper;
|
||||||
use dom::window::Window;
|
use dom::window::Window;
|
||||||
use url::{Url, UrlParser};
|
use url::Url;
|
||||||
use util::str::DOMString;
|
use util::str::DOMString;
|
||||||
|
|
||||||
#[dom_struct]
|
#[dom_struct]
|
||||||
|
@ -51,7 +51,7 @@ impl LocationMethods for Location {
|
||||||
// TODO: per spec, we should use the _API base URL_ specified by the
|
// TODO: per spec, we should use the _API base URL_ specified by the
|
||||||
// _entry settings object_.
|
// _entry settings object_.
|
||||||
let base_url = self.window.get_url();
|
let base_url = self.window.get_url();
|
||||||
if let Ok(url) = UrlParser::new().base_url(&base_url).parse(&url.0) {
|
if let Ok(url) = base_url.join(&url.0) {
|
||||||
self.window.load_url(url);
|
self.window.load_url(url);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -98,7 +98,7 @@ impl LocationMethods for Location {
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/#dom-location-href
|
// https://html.spec.whatwg.org/multipage/#dom-location-href
|
||||||
fn SetHref(&self, value: USVString) {
|
fn SetHref(&self, value: USVString) {
|
||||||
if let Ok(url) = UrlParser::new().base_url(&self.window.get_url()).parse(&value.0) {
|
if let Ok(url) = self.window.get_url().join(&value.0) {
|
||||||
self.window.load_url(url);
|
self.window.load_url(url);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,6 @@ use js::jsapi::{JSAutoCompartment, JSAutoRequest};
|
||||||
use js::jsval::UndefinedValue;
|
use js::jsval::UndefinedValue;
|
||||||
use script_task::{Runnable, ScriptChan};
|
use script_task::{Runnable, ScriptChan};
|
||||||
use std::sync::mpsc::{Sender, channel};
|
use std::sync::mpsc::{Sender, channel};
|
||||||
use url::UrlParser;
|
|
||||||
use util::str::DOMString;
|
use util::str::DOMString;
|
||||||
|
|
||||||
pub type TrustedWorkerAddress = Trusted<Worker>;
|
pub type TrustedWorkerAddress = Trusted<Worker>;
|
||||||
|
@ -64,7 +63,7 @@ impl Worker {
|
||||||
// https://html.spec.whatwg.org/multipage/#dom-worker
|
// https://html.spec.whatwg.org/multipage/#dom-worker
|
||||||
pub fn Constructor(global: GlobalRef, script_url: DOMString) -> Fallible<Root<Worker>> {
|
pub fn Constructor(global: GlobalRef, script_url: DOMString) -> Fallible<Root<Worker>> {
|
||||||
// Step 2-4.
|
// Step 2-4.
|
||||||
let worker_url = match UrlParser::new().base_url(&global.get_url()).parse(&script_url) {
|
let worker_url = match global.get_url().join(&script_url) {
|
||||||
Ok(url) => url,
|
Ok(url) => url,
|
||||||
Err(_) => return Err(Error::Syntax),
|
Err(_) => return Err(Error::Syntax),
|
||||||
};
|
};
|
||||||
|
|
|
@ -31,7 +31,7 @@ use std::default::Default;
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
use std::sync::mpsc::Receiver;
|
use std::sync::mpsc::Receiver;
|
||||||
use timers::{ActiveTimers, IsInterval, ScheduledCallback, TimerCallback, TimerHandle};
|
use timers::{ActiveTimers, IsInterval, ScheduledCallback, TimerCallback, TimerHandle};
|
||||||
use url::{Url, UrlParser};
|
use url::Url;
|
||||||
use util::str::DOMString;
|
use util::str::DOMString;
|
||||||
|
|
||||||
#[derive(Copy, Clone, PartialEq)]
|
#[derive(Copy, Clone, PartialEq)]
|
||||||
|
@ -195,8 +195,7 @@ impl WorkerGlobalScopeMethods for WorkerGlobalScope {
|
||||||
fn ImportScripts(&self, url_strings: Vec<DOMString>) -> ErrorResult {
|
fn ImportScripts(&self, url_strings: Vec<DOMString>) -> ErrorResult {
|
||||||
let mut urls = Vec::with_capacity(url_strings.len());
|
let mut urls = Vec::with_capacity(url_strings.len());
|
||||||
for url in url_strings {
|
for url in url_strings {
|
||||||
let url = UrlParser::new().base_url(&self.worker_url)
|
let url = self.worker_url.join(&url);
|
||||||
.parse(&url);
|
|
||||||
match url {
|
match url {
|
||||||
Ok(url) => urls.push(url),
|
Ok(url) => urls.push(url),
|
||||||
Err(_) => return Err(Error::Syntax),
|
Err(_) => return Err(Error::Syntax),
|
||||||
|
|
|
@ -60,7 +60,7 @@ use std::sync::{Arc, Mutex};
|
||||||
use string_cache::Atom;
|
use string_cache::Atom;
|
||||||
use time;
|
use time;
|
||||||
use timers::{ScheduledCallback, TimerHandle};
|
use timers::{ScheduledCallback, TimerHandle};
|
||||||
use url::{Url, UrlParser};
|
use url::Url;
|
||||||
use util::mem::HeapSizeOf;
|
use util::mem::HeapSizeOf;
|
||||||
use util::str::DOMString;
|
use util::str::DOMString;
|
||||||
|
|
||||||
|
@ -326,7 +326,7 @@ impl XMLHttpRequestMethods for XMLHttpRequest {
|
||||||
|
|
||||||
// Step 6
|
// Step 6
|
||||||
let base = self.global.root().r().get_url();
|
let base = self.global.root().r().get_url();
|
||||||
let parsed_url = match UrlParser::new().base_url(&base).parse(&url) {
|
let parsed_url = match base.join(&url) {
|
||||||
Ok(parsed) => parsed,
|
Ok(parsed) => parsed,
|
||||||
Err(_) => return Err(Error::Syntax) // Step 7
|
Err(_) => return Err(Error::Syntax) // Step 7
|
||||||
};
|
};
|
||||||
|
@ -1109,7 +1109,7 @@ impl XMLHttpRequest {
|
||||||
let doc = doc.r();
|
let doc = doc.r();
|
||||||
let docloader = DocumentLoader::new(&*doc.loader());
|
let docloader = DocumentLoader::new(&*doc.loader());
|
||||||
let base = self.global.root().r().get_url();
|
let base = self.global.root().r().get_url();
|
||||||
let parsed_url = match UrlParser::new().base_url(&base).parse(&self.ResponseURL()) {
|
let parsed_url = match base.join(&self.ResponseURL()) {
|
||||||
Ok(parsed) => Some(parsed),
|
Ok(parsed) => Some(parsed),
|
||||||
Err(_) => None // Step 7
|
Err(_) => None // Step 7
|
||||||
};
|
};
|
||||||
|
|
|
@ -98,7 +98,7 @@ use std::sync::atomic::{Ordering, AtomicBool};
|
||||||
use std::sync::mpsc::{Receiver, Select, Sender, channel};
|
use std::sync::mpsc::{Receiver, Select, Sender, channel};
|
||||||
use std::sync::{Arc, Mutex};
|
use std::sync::{Arc, Mutex};
|
||||||
use time::{Tm, now};
|
use time::{Tm, now};
|
||||||
use url::{Url, UrlParser};
|
use url::Url;
|
||||||
use util::opts;
|
use util::opts;
|
||||||
use util::str::DOMString;
|
use util::str::DOMString;
|
||||||
use util::task;
|
use util::task;
|
||||||
|
@ -1840,7 +1840,7 @@ impl ScriptTask {
|
||||||
.and_then(|href| {
|
.and_then(|href| {
|
||||||
let value = href.value();
|
let value = href.value();
|
||||||
let url = document.url();
|
let url = document.url();
|
||||||
UrlParser::new().base_url(&url).parse(&value).map(|url| url.serialize()).ok()
|
url.join(&value).map(|url| url.serialize()).ok()
|
||||||
});
|
});
|
||||||
let event = ConstellationMsg::NodeStatus(status);
|
let event = ConstellationMsg::NodeStatus(status);
|
||||||
let ConstellationChan(ref chan) = self.constellation_chan;
|
let ConstellationChan(ref chan) = self.constellation_chan;
|
||||||
|
|
|
@ -45,4 +45,4 @@ euclid = {version = "0.4", features = ["plugins"]}
|
||||||
serde = "0.6"
|
serde = "0.6"
|
||||||
serde_macros = "0.6"
|
serde_macros = "0.6"
|
||||||
time = "0.1.12"
|
time = "0.1.12"
|
||||||
url = "0.5"
|
url = "0.5.2"
|
||||||
|
|
|
@ -145,5 +145,5 @@ env_logger = "0.3"
|
||||||
time = "0.1.12"
|
time = "0.1.12"
|
||||||
bitflags = "0.3"
|
bitflags = "0.3"
|
||||||
libc = "0.2"
|
libc = "0.2"
|
||||||
url = {version = "0.5", features = ["serde_serialization", "query_encoding"]}
|
url = {version = "0.5.2", features = ["serde_serialization", "query_encoding"]}
|
||||||
euclid = {version = "0.4", features = ["plugins"]}
|
euclid = {version = "0.4", features = ["plugins"]}
|
||||||
|
|
|
@ -38,5 +38,5 @@ string_cache = "0.2"
|
||||||
euclid = {version = "0.4", features = ["plugins"]}
|
euclid = {version = "0.4", features = ["plugins"]}
|
||||||
serde = "0.6"
|
serde = "0.6"
|
||||||
serde_macros = "0.6"
|
serde_macros = "0.6"
|
||||||
url = "0.5"
|
url = "0.5.2"
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ use parser::{ParserContext, log_css_error};
|
||||||
use properties::longhands::font_family::parse_one_family;
|
use properties::longhands::font_family::parse_one_family;
|
||||||
use std::ascii::AsciiExt;
|
use std::ascii::AsciiExt;
|
||||||
use string_cache::Atom;
|
use string_cache::Atom;
|
||||||
use url::{Url, UrlParser};
|
use url::Url;
|
||||||
use util::mem::HeapSizeOf;
|
use util::mem::HeapSizeOf;
|
||||||
|
|
||||||
#[derive(Clone, Debug, HeapSizeOf, PartialEq, Eq, Deserialize, Serialize)]
|
#[derive(Clone, Debug, HeapSizeOf, PartialEq, Eq, Deserialize, Serialize)]
|
||||||
|
@ -111,7 +111,7 @@ fn parse_one_src(context: &ParserContext, input: &mut Parser) -> Result<Source,
|
||||||
return Ok(Source::Local(try!(input.parse_nested_block(parse_one_non_generic_family_name))))
|
return Ok(Source::Local(try!(input.parse_nested_block(parse_one_non_generic_family_name))))
|
||||||
}
|
}
|
||||||
let url = try!(input.expect_url());
|
let url = try!(input.expect_url());
|
||||||
let url = UrlParser::new().base_url(context.base_url).parse(&url).unwrap_or_else(
|
let url = context.base_url.join(&url).unwrap_or_else(
|
||||||
|_error| url!("about:invalid"));
|
|_error| url!("about:invalid"));
|
||||||
|
|
||||||
// Parsing optional format()
|
// Parsing optional format()
|
||||||
|
|
|
@ -7,7 +7,7 @@ use cssparser::{Parser, SourcePosition};
|
||||||
use msg::ParseErrorReporter;
|
use msg::ParseErrorReporter;
|
||||||
use selectors::parser::ParserContext as SelectorParserContext;
|
use selectors::parser::ParserContext as SelectorParserContext;
|
||||||
use stylesheets::Origin;
|
use stylesheets::Origin;
|
||||||
use url::{Url, UrlParser};
|
use url::Url;
|
||||||
|
|
||||||
pub struct ParserContext<'a> {
|
pub struct ParserContext<'a> {
|
||||||
pub stylesheet_origin: Origin,
|
pub stylesheet_origin: Origin,
|
||||||
|
@ -33,7 +33,7 @@ impl<'a> ParserContext<'a> {
|
||||||
|
|
||||||
impl<'a> ParserContext<'a> {
|
impl<'a> ParserContext<'a> {
|
||||||
pub fn parse_url(&self, input: &str) -> Url {
|
pub fn parse_url(&self, input: &str) -> Url {
|
||||||
UrlParser::new().base_url(self.base_url).parse(input)
|
self.base_url.join(input)
|
||||||
.unwrap_or_else(|_| url!("about:invalid"))
|
.unwrap_or_else(|_| url!("about:invalid"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,5 +23,5 @@ rustc-serialize = "0.3"
|
||||||
selectors = "0.2"
|
selectors = "0.2"
|
||||||
serde = "0.6"
|
serde = "0.6"
|
||||||
serde_macros = "0.6"
|
serde_macros = "0.6"
|
||||||
url = "0.5"
|
url = "0.5.2"
|
||||||
|
|
||||||
|
|
|
@ -52,5 +52,5 @@ string_cache = "0.2"
|
||||||
lazy_static = "0.1"
|
lazy_static = "0.1"
|
||||||
getopts = "0.2.11"
|
getopts = "0.2.11"
|
||||||
hyper = "0.7"
|
hyper = "0.7"
|
||||||
url = "0.5"
|
url = "0.5.2"
|
||||||
uuid = "0.1.17"
|
uuid = "0.1.17"
|
||||||
|
|
|
@ -31,5 +31,5 @@ log = "0.3"
|
||||||
hyper = "0.7"
|
hyper = "0.7"
|
||||||
rustc-serialize = "0.3.4"
|
rustc-serialize = "0.3.4"
|
||||||
regex = "0.1.33"
|
regex = "0.1.33"
|
||||||
url = "0.5"
|
url = "0.5.2"
|
||||||
uuid = "0.1"
|
uuid = "0.1"
|
||||||
|
|
|
@ -10,7 +10,7 @@ crate-type = ["dylib"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
log = "0.3"
|
log = "0.3"
|
||||||
url = "0.5"
|
url = "0.5.2"
|
||||||
libc = "0.2"
|
libc = "0.2"
|
||||||
euclid = {version = "0.4", features = ["plugins"]}
|
euclid = {version = "0.4", features = ["plugins"]}
|
||||||
gleam = "0.2"
|
gleam = "0.2"
|
||||||
|
|
|
@ -15,7 +15,7 @@ headless = ["servo-glutin/headless"]
|
||||||
time = "0.1.12"
|
time = "0.1.12"
|
||||||
bitflags = "0.3"
|
bitflags = "0.3"
|
||||||
libc = "0.2"
|
libc = "0.2"
|
||||||
url = "0.5"
|
url = "0.5.2"
|
||||||
gleam = "0.2"
|
gleam = "0.2"
|
||||||
euclid = {version = "0.4", features = ["plugins"]}
|
euclid = {version = "0.4", features = ["plugins"]}
|
||||||
servo-glutin = "0.4"
|
servo-glutin = "0.4"
|
||||||
|
|
|
@ -42,7 +42,7 @@ path = "../../components/util"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
env_logger = "0.3"
|
env_logger = "0.3"
|
||||||
url = "0.5"
|
url = "0.5.2"
|
||||||
time = "0.1.17"
|
time = "0.1.17"
|
||||||
errno = "0.1"
|
errno = "0.1"
|
||||||
libc = "0.2"
|
libc = "0.2"
|
||||||
|
|
|
@ -32,6 +32,6 @@ git = "https://github.com/servo/ipc-channel"
|
||||||
[dependencies]
|
[dependencies]
|
||||||
cookie = "0.2"
|
cookie = "0.2"
|
||||||
hyper = "0.7"
|
hyper = "0.7"
|
||||||
url = "0.5"
|
url = "0.5.2"
|
||||||
time = "0.1"
|
time = "0.1"
|
||||||
flate2 = "0.2.0"
|
flate2 = "0.2.0"
|
||||||
|
|
|
@ -12,4 +12,4 @@ doctest = false
|
||||||
path = "../../../components/plugins"
|
path = "../../../components/plugins"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
url = "0.5"
|
url = "0.5.2"
|
||||||
|
|
|
@ -25,7 +25,7 @@ path = "../../../components/util"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
app_units = {version = "0.1", features = ["plugins"]}
|
app_units = {version = "0.1", features = ["plugins"]}
|
||||||
url = "0.5"
|
url = "0.5.2"
|
||||||
cssparser = "0.4"
|
cssparser = "0.4"
|
||||||
selectors = "0.2"
|
selectors = "0.2"
|
||||||
string_cache = "0.2"
|
string_cache = "0.2"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue