Avoid a panic when clicking a link whose href is unparsable.

This commit is contained in:
Ms2ger 2015-08-09 17:56:50 +02:00
parent ecb6551efa
commit 97c79bbb99
2 changed files with 4 additions and 4 deletions

View file

@ -178,7 +178,10 @@ fn follow_hyperlink(subject: &Element, hyperlink_suffix: Option<DOMString>) {
// Step 4-5. // Step 4-5.
let document = document_from_node(subject); let document = document_from_node(subject);
let url = UrlParser::new().base_url(&document.url()).parse(&href).unwrap(); let url = match UrlParser::new().base_url(&document.url()).parse(&href) {
Ok(url) => url,
Err(_) => return,
};
// Step 7. // Step 7.
debug!("following hyperlink to {}", url.serialize()); debug!("following hyperlink to {}", url.serialize());

View file

@ -1,3 +0,0 @@
[follow-hyperlink.html]
type: testharness
expected: CRASH