diff options
author | Timothy Flynn <trflynn89@pm.me> | 2023-04-19 09:20:48 -0400 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2023-04-20 06:19:41 +0200 |
commit | d2f9645cc00be122625298a7d7ddbb36bb5ba3aa (patch) | |
tree | bb8683fe52a4f5860acfb83b8662328efce3e786 /Userland/Libraries/LibWeb/HTML/HTMLMediaElement.cpp | |
parent | 8d4d01d99ab850676a8d48aaadf875ebff51b2d0 (diff) | |
download | serenity-d2f9645cc00be122625298a7d7ddbb36bb5ba3aa.zip |
LibWeb: Properly stop, rather than terminate, ongoing media fetches
We are currently using the fetch controller's terminate() method to stop
ongoing fetches when the HTMLMediaElement load algorithm is invoked.
This method ultimately causes the fetch response to be a network error,
which we propagate through the HTMLMediaElement's error event. This can
cause websites, such as Steam, to avoid attempting to play any video.
The spec does not actually specify what it means to "stop" or "cancel" a
fetching process. But we should not use terminate() as that is a defined
spec method, and the spec does tend to indicate when that method should
be used (e.g. as it does in XMLHttpRequest).
Diffstat (limited to 'Userland/Libraries/LibWeb/HTML/HTMLMediaElement.cpp')
-rw-r--r-- | Userland/Libraries/LibWeb/HTML/HTMLMediaElement.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLMediaElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLMediaElement.cpp index 5f7018f68a..e8b878f4c8 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLMediaElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLMediaElement.cpp @@ -314,7 +314,7 @@ WebIDL::ExceptionOr<void> HTMLMediaElement::load_element() // 2. If a fetching process is in progress for the media element, the user agent should stop it. if (m_fetch_controller && m_fetch_controller->state() == Fetch::Infrastructure::FetchController::State::Ongoing) - m_fetch_controller->terminate(); + m_fetch_controller->stop_fetch(); // FIXME: 3. If the media element's assigned media provider object is a MediaSource object, then detach it. // FIXME: 4. Forget the media element's media-resource-specific tracks. @@ -728,7 +728,7 @@ WebIDL::ExceptionOr<void> HTMLMediaElement::process_media_data(Function<void()> // -> If the media data can be fetched but is found by inspection to be in an unsupported format, or can otherwise not be rendered at all if (playback_manager.is_error()) { // 1. The user agent should cancel the fetching process. - m_fetch_controller->terminate(); + m_fetch_controller->stop_fetch(); // 2. Abort this subalgorithm, returning to the resource selection algorithm. failure_callback(); |