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

@ -164,14 +164,14 @@ WebIDL::ExceptionOr<void> HTMLVideoElement::determine_element_poster_frame(Optio
// 3. Parse the poster attribute's value relative to the element's node document. If this fails, then there is no
// poster frame; return.
auto url_record = document().parse_url(*poster);
if (!url_record.is_valid())
if (!url_record.has_value())
return {};
// 4. Let request be a new request whose URL is the resulting URL record, client is the element's node document's
// relevant settings object, destination is "image", initiator type is "video", credentials mode is "include",
// and whose use-URL-credentials flag is set.
auto request = Fetch::Infrastructure::Request::create(vm);
request->set_url(move(url_record));
request->set_url(url_record.release_value());
request->set_client(&document().relevant_settings_object());
request->set_destination(Fetch::Infrastructure::Request::Destination::Image);
request->set_initiator_type(Fetch::Infrastructure::Request::InitiatorType::Video);