mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-25 17:25:08 +02:00
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:
committed by
Gregory Bertilson
parent
32efd1ffa0
commit
696a328253
Notes:
github-actions[bot]
2026-02-27 04:05:08 +00:00
Author: https://github.com/Zaggy1024 Commit: https://github.com/LadybirdBrowser/ladybird/commit/696a328253c Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/8179 Reviewed-by: https://github.com/shannonbooth Reviewed-by: https://github.com/trflynn89
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user