LibWeb: Keep delaying the load if an error event changes the media src

This commit is contained in:
Zaggy1024
2026-02-26 17:22:17 -06:00
committed by Gregory Bertilson
parent 44ed83f4fe
commit 02a2eb6da5
Notes: github-actions[bot] 2026-02-27 04:04:01 +00:00
2 changed files with 7 additions and 1 deletions

View File

@@ -1629,6 +1629,12 @@ void HTMLMediaElement::handle_media_source_failure(Span<GC::Ref<WebIDL::Promise>
// 5. Fire an event named error at the media element.
dispatch_event(DOM::Event::create(realm, HTML::EventNames::error));
// NB: If the error has been reset, that means we've entered load_element() within the error
// event handler. If that's the case, as part of the resource selection algorithm, these
// steps must abort.
if (!m_error)
return;
// 6. Reject pending play promises with promises and a "NotSupportedError" DOMException.
reject_pending_play_promises<WebIDL::NotSupportedError>(promises, "Media is not supported"_utf16);