aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/script/html/hubbub_html_parser.rs
diff options
context:
space:
mode:
authorManish Goregaokar <manishsmail@gmail.com>2014-07-07 19:31:19 +0530
committerManish Goregaokar <manishsmail@gmail.com>2014-07-07 20:28:55 +0530
commita0e413cf1a2c7659a484dd1f33375cb1efd3882f (patch)
tree07783e2361ae57c8d70d808867bde9a536095a1b /src/components/script/html/hubbub_html_parser.rs
parent7babb6d104d28119d95d2309d686a388717eb95c (diff)
downloadservo-a0e413cf1a2c7659a484dd1f33375cb1efd3882f.tar.gz
servo-a0e413cf1a2c7659a484dd1f33375cb1efd3882f.zip
Don't fail on parsing URLs in the html parser
Diffstat (limited to 'src/components/script/html/hubbub_html_parser.rs')
-rw-r--r--src/components/script/html/hubbub_html_parser.rs14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/components/script/html/hubbub_html_parser.rs b/src/components/script/html/hubbub_html_parser.rs
index baacfcef52c..941e05044f4 100644
--- a/src/components/script/html/hubbub_html_parser.rs
+++ b/src/components/script/html/hubbub_html_parser.rs
@@ -23,7 +23,7 @@ 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::parse_url;
+use servo_util::url::try_parse_url;
use std::ascii::StrAsciiExt;
use std::mem;
use std::cell::RefCell;
@@ -421,8 +421,10 @@ pub fn parse_html(page: &Page,
s.as_slice().eq_ignore_ascii_case("stylesheet")
}) => {
debug!("found CSS stylesheet: {:s}", *href);
- let url = parse_url(href.as_slice(), Some(url2.clone()));
- css_chan2.send(CSSTaskNewFile(UrlProvenance(url, resource_task.clone())));
+ match try_parse_url(href.as_slice(), Some(url2.clone())) {
+ Ok(url) => css_chan2.send(CSSTaskNewFile(UrlProvenance(url, resource_task.clone()))),
+ Err(e) => debug!("Parsing url {:s} failed: {:s}", *href, e)
+ };
}
_ => {}
}
@@ -502,8 +504,10 @@ pub fn parse_html(page: &Page,
match script.get_attribute(Null, "src").root() {
Some(src) => {
debug!("found script: {:s}", src.deref().Value());
- let new_url = parse_url(src.deref().value().as_slice(), Some(url3.clone()));
- js_chan2.send(JSTaskNewFile(new_url));
+ 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)
+ };
}
None => {
let mut data = String::new();