LibWeb: Skip waiting for media source failure steps to execute

This wasn't actually doing anything except nesting things within a
spin_until() call.
This commit is contained in:
Zaggy1024
2026-02-25 17:53:15 -06:00
committed by Gregory Bertilson
parent 32efd1ffa0
commit 696a328253
Notes: github-actions[bot] 2026-02-27 04:05:08 +00:00

View File

@@ -904,19 +904,15 @@ void HTMLMediaElement::select_resource()
// -> If mode is attribute
case SelectMode::Attribute: {
auto failed_with_attribute = [this](auto error_message) {
IGNORE_USE_IN_ESCAPING_LAMBDA bool ran_media_element_task = false;
// 6. Failed with attribute: Reaching this step indicates that the media resource failed to load or that the given URL could not be parsed. Take
// pending play promises and queue a media element task given the media element to run the dedicated media source failure steps with the result.
queue_a_media_element_task([this, &ran_media_element_task, error_message = move(error_message)]() mutable {
queue_a_media_element_task([this, error_message = move(error_message)]() mutable {
auto promises = take_pending_play_promises();
handle_media_source_failure(promises, move(error_message));
ran_media_element_task = true;
});
// 7. Wait for the task queued by the previous step to have executed.
HTML::main_thread_event_loop().spin_until(GC::create_function(heap(), [&]() { return ran_media_element_task; }));
// AD-HOC: All calls to the failure steps immediately return, so we do not actually need to wait here.
};
// 1. ⌛ If the src attribute's value is the empty string, then end the synchronous section, and jump down to the failed with attribute step below.