LibWeb: Parse CSS/image URLs using DOMURL::parse

DOMURL::parse handles blob URLs.
This commit is contained in:
Timothy Flynn 2025-08-08 09:55:38 -04:00 committed by Tim Ledbetter
commit 4a8c70b3a5
Notes: github-actions[bot] 2025-08-08 16:48:55 +00:00
6 changed files with 60 additions and 7 deletions

View file

@ -4,10 +4,10 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibURL/Parser.h>
#include <LibWeb/CSS/CSSStyleSheet.h>
#include <LibWeb/CSS/Fetch.h>
#include <LibWeb/DOM/Document.h>
#include <LibWeb/DOMURL/DOMURL.h>
#include <LibWeb/Fetch/Fetching/Fetching.h>
#include <LibWeb/HTML/SharedResourceRequest.h>
@ -38,7 +38,8 @@ static WebIDL::ExceptionOr<GC::Ref<Fetch::Infrastructure::Request>> fetch_a_styl
auto url_string = url_value.visit(
[](::URL::URL const& url) { return url.to_string(); },
[](CSS::URL const& url) { return url.url(); });
auto parsed_url = ::URL::Parser::basic_parse(url_string, base);
auto parsed_url = DOMURL::parse(url_string, base);
if (!parsed_url.has_value())
return WebIDL::SimpleException { WebIDL::SimpleExceptionType::URIError, "Failed to parse URL"sv };