diff options
author | Ms2ger <Ms2ger@gmail.com> | 2015-08-09 17:56:50 +0200 |
---|---|---|
committer | Ms2ger <Ms2ger@gmail.com> | 2015-08-09 20:05:35 +0200 |
commit | 97c79bbb995b0d2dc1f4af8b972bb6dcea54cddf (patch) | |
tree | 89ebe6389cf7804a89e42fcf65d3b10ffd2b7b32 | |
parent | ecb6551efa04a6469616630fba71e11978a52458 (diff) | |
download | servo-97c79bbb995b0d2dc1f4af8b972bb6dcea54cddf.tar.gz servo-97c79bbb995b0d2dc1f4af8b972bb6dcea54cddf.zip |
Avoid a panic when clicking a link whose href is unparsable.
-rw-r--r-- | components/script/dom/htmlanchorelement.rs | 5 | ||||
-rw-r--r-- | tests/wpt/mozilla/meta/mozilla/follow-hyperlink.html.ini | 3 |
2 files changed, 4 insertions, 4 deletions
diff --git a/components/script/dom/htmlanchorelement.rs b/components/script/dom/htmlanchorelement.rs index 53478dc6aca..b47d799c8ae 100644 --- a/components/script/dom/htmlanchorelement.rs +++ b/components/script/dom/htmlanchorelement.rs @@ -178,7 +178,10 @@ fn follow_hyperlink(subject: &Element, hyperlink_suffix: Option<DOMString>) { // Step 4-5. 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. debug!("following hyperlink to {}", url.serialize()); diff --git a/tests/wpt/mozilla/meta/mozilla/follow-hyperlink.html.ini b/tests/wpt/mozilla/meta/mozilla/follow-hyperlink.html.ini deleted file mode 100644 index 8e6e2200a5f..00000000000 --- a/tests/wpt/mozilla/meta/mozilla/follow-hyperlink.html.ini +++ /dev/null @@ -1,3 +0,0 @@ -[follow-hyperlink.html] - type: testharness - expected: CRASH |