aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/script/html/hubbub_html_parser.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/script/html/hubbub_html_parser.rs')
-rw-r--r--src/components/script/html/hubbub_html_parser.rs15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/components/script/html/hubbub_html_parser.rs b/src/components/script/html/hubbub_html_parser.rs
index bc2c3e2c8f8..11e3ca81610 100644
--- a/src/components/script/html/hubbub_html_parser.rs
+++ b/src/components/script/html/hubbub_html_parser.rs
@@ -23,13 +23,12 @@ use servo_util::namespace;
use servo_util::namespace::{Namespace, Null};
use servo_util::str::{DOMString, HTML_SPACE_CHARACTERS};
use servo_util::task::spawn_named;
-use servo_util::url::try_parse_url;
use std::ascii::StrAsciiExt;
use std::mem;
use std::cell::RefCell;
use std::comm::{channel, Sender, Receiver};
use style::Stylesheet;
-use url::Url;
+use url::{Url, UrlParser};
macro_rules! handle_element(
($document: expr,
@@ -421,8 +420,9 @@ pub fn parse_html(page: &Page,
s.as_slice().eq_ignore_ascii_case("stylesheet")
}) => {
debug!("found CSS stylesheet: {:s}", *href);
- match try_parse_url(href.as_slice(), Some(url2.clone())) {
- Ok(url) => css_chan2.send(CSSTaskNewFile(UrlProvenance(url, resource_task.clone()))),
+ match UrlParser::new().base_url(&url2).parse(href.as_slice()) {
+ Ok(url) => css_chan2.send(CSSTaskNewFile(
+ UrlProvenance(url, resource_task.clone()))),
Err(e) => debug!("Parsing url {:s} failed: {:s}", *href, e)
};
}
@@ -504,9 +504,10 @@ pub fn parse_html(page: &Page,
match script.get_attribute(Null, "src").root() {
Some(src) => {
debug!("found script: {:s}", src.deref().Value());
- match try_parse_url(src.deref().value().as_slice(), Some(url3.clone())) {
- Ok(new_url) => js_chan2.send(JSTaskNewFile(new_url)),
- Err(e) => debug!("Parsing url {:s} failed: {:s}", src.deref().Value(), e)
+ match UrlParser::new().base_url(&url3)
+ .parse(src.deref().value().as_slice()) {
+ Ok(new_url) => js_chan2.send(JSTaskNewFile(new_url)),
+ Err(e) => debug!("Parsing url {:s} failed: {:s}", src.deref().Value(), e)
};
}
None => {