LibWeb: Port Document encoding_parse_url and parse_url to Optional<URL>

This ports two more APIs away from URL::is_valid.
This commit is contained in:
Shannon Booth 2025-01-23 19:40:57 +13:00 committed by Tim Ledbetter
parent cfe9b7a82b
commit 22a7cd9700
Notes: github-actions[bot] 2025-01-27 00:04:07 +00:00
26 changed files with 135 additions and 107 deletions

View file

@ -53,11 +53,12 @@ void SVGScriptElement::process_the_script_element()
if (has_attribute(SVG::AttributeNames::href) || has_attribute_ns(Namespace::XLink.to_string(), SVG::AttributeNames::href)) {
auto href_value = href()->base_val();
script_url = document().parse_url(href_value);
if (!script_url.is_valid()) {
auto maybe_script_url = document().parse_url(href_value);
if (!maybe_script_url.has_value()) {
dbgln("Invalid script URL: {}", href_value);
return;
}
script_url = maybe_script_url.release_value();
auto& vm = realm().vm();
auto request = Fetch::Infrastructure::Request::create(vm);