LibWeb: Increment the fetch generation when cancelling media fetch

The case of an unsupported format error wasn't covered for this,
meaning that it could crash if the fetch completed successfully after
the fetch was cancelled due to such an error.

A crash test is included for this issue, using an echo of a large
corrupted WebM file to ensure that the fetch completes after media
init.
This commit is contained in:
Zaggy1024
2026-04-06 19:29:52 -05:00
committed by Alexander Kalenik
parent 6a46bcaf35
commit 84e0b7d36f
Notes: github-actions[bot] 2026-04-08 11:04:31 +00:00
2 changed files with 38 additions and 4 deletions

View File

@@ -1782,12 +1782,11 @@ void HTMLMediaElement::set_up_playback_manager_for_remote()
// 1. The user agent should cancel the fetching process.
VERIFY(self->m_remote_fetch_data);
auto fetch_data = move(self->m_remote_fetch_data);
if (fetch_data->fetch_controller)
fetch_data->fetch_controller->stop_fetch();
auto failure_callback = move(self->m_remote_fetch_data->failure_callback);
self->cancel_the_fetching_process();
// 2. Abort this subalgorithm, returning to the resource selection algorithm.
fetch_data->failure_callback(MUST(String::from_utf8(error.description())));
failure_callback(MUST(String::from_utf8(error.description())));
});
});