LibWeb: Do not handle media ready state changes for empty network states

This was missed in the header text of the ready state transition spec.
This commit is contained in:
Timothy Flynn 2023-04-19 08:44:17 -04:00 committed by Andreas Kling
parent 27fd31b2ad
commit 1fb0c7826b

View file

@ -904,6 +904,12 @@ void HTMLMediaElement::set_ready_state(ReadyState ready_state)
{
ScopeGuard guard { [&] { m_ready_state = ready_state; } };
// When the ready state of a media element whose networkState is not NETWORK_EMPTY changes, the user agent must
// follow the steps given below:
if (m_network_state == NetworkState::Empty)
return;
// 1. Apply the first applicable set of substeps from the following list:
// -> If the previous ready state was HAVE_NOTHING, and the new ready state is HAVE_METADATA
if (m_ready_state == ReadyState::HaveNothing && ready_state == ReadyState::HaveMetadata) {
// Queue a media element task given the media element to fire an event named loadedmetadata at the element.