LibWeb: Do not assume hovered URLs are valid

Let's just not display any tooltip for invalid URLs. This matches how
Firefox behaves.
This commit is contained in:
Timothy Flynn 2025-10-27 08:04:27 -04:00 committed by Tim Ledbetter
parent 73b01a975a
commit 2a68087dfc
2 changed files with 8 additions and 2 deletions

View File

@ -874,8 +874,10 @@ EventResult EventHandler::handle_mousemove(CSSPixelPoint visual_viewport_positio
}
if (is_hovering_link) {
page.set_is_hovering_link(true);
page.client().page_did_hover_link(*document.encoding_parse_url(hovered_link_element->href()));
if (auto link_url = document.encoding_parse_url(hovered_link_element->href()); link_url.has_value()) {
page.set_is_hovering_link(true);
page.client().page_did_hover_link(*link_url);
}
} else if (page.is_hovering_link()) {
page.set_is_hovering_link(false);
page.client().page_did_unhover_link();

View File

@ -0,0 +1,4 @@
<a href="https://xn--a.com">Invalid URL</a>
<script>
internals.movePointerTo(30, 20);
</script>