From 277aceac988715ab34e6fb136fdfb9da00d41645 Mon Sep 17 00:00:00 2001 From: Shannon Booth Date: Sat, 22 Feb 2025 20:36:37 +1300 Subject: [PATCH] LibWeb/HTML: Parse URL track URL before creating fetch request This is a bit weird in the spec in it passing through a string here instead of a URL record. However, the string being used in this case should only ever be a valid URL string if it is not the empty string. --- Libraries/LibWeb/HTML/HTMLTrackElement.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Libraries/LibWeb/HTML/HTMLTrackElement.cpp b/Libraries/LibWeb/HTML/HTMLTrackElement.cpp index 00ec4db29b4..9993627e057 100644 --- a/Libraries/LibWeb/HTML/HTMLTrackElement.cpp +++ b/Libraries/LibWeb/HTML/HTMLTrackElement.cpp @@ -6,6 +6,7 @@ * SPDX-License-Identifier: BSD-2-Clause */ +#include #include #include #include @@ -191,7 +192,9 @@ void HTMLTrackElement::start_the_track_processing_model_parallel_steps(JS::Realm if (!url.is_empty()) { // 1. Let request be the result of creating a potential-CORS request given URL, "track", and corsAttributeState, // and with the same-origin fallback flag set. - auto request = create_potential_CORS_request(realm.vm(), url, Fetch::Infrastructure::Request::Destination::Track, cors_attribute_state, SameOriginFallbackFlag::Yes); + auto parsed_url = URL::Parser::basic_parse(url); + VERIFY(parsed_url.has_value()); + auto request = create_potential_CORS_request(realm.vm(), parsed_url.release_value(), Fetch::Infrastructure::Request::Destination::Track, cors_attribute_state, SameOriginFallbackFlag::Yes); // 2. Set request's client to the track element's node document's relevant settings object. request->set_client(&document().relevant_settings_object());