mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-25 17:25:08 +02:00
LibWeb: Always close remote media resource streams on a request error
Otherwise, the PlaybackManager may get stuck waiting for enough data to read the metadata and call on_metadata_parsed. This is unfortunately difficult to test without direct control over the fetching process, but it could cause flakes in tests that wait for loadeddata.
This commit is contained in:
committed by
Gregory Bertilson
parent
973d3da0e7
commit
29d9667511
Notes:
github-actions[bot]
2026-04-22 00:13:34 +00:00
Author: https://github.com/Zaggy1024 Commit: https://github.com/LadybirdBrowser/ladybird/commit/29d96675118 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/9004
@@ -1279,6 +1279,7 @@ void HTMLMediaElement::load_remote_resource(ByteRange const& byte_range)
|
||||
// NOTE: We do this step before creating the updateMedia task so that we can invoke the failure callback.
|
||||
auto maybe_verify_response_failure = self->verify_response_or_get_failure_reason(response, byte_range);
|
||||
if (maybe_verify_response_failure.has_value()) {
|
||||
fetch_data->stream->close();
|
||||
fetch_data->failure_callback(maybe_verify_response_failure.value());
|
||||
return;
|
||||
}
|
||||
@@ -1328,6 +1329,8 @@ void HTMLMediaElement::load_remote_resource(ByteRange const& byte_range)
|
||||
return;
|
||||
if (fetch_generation != weak_self->m_current_fetch_generation)
|
||||
return;
|
||||
|
||||
weak_self->m_remote_fetch_data->stream->close();
|
||||
weak_self->queue_a_media_element_task([self = weak_self.as_nonnull()] {
|
||||
self->process_media_data(FetchingStatus::Interrupted);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user