Skip to content

Truly independent web browser

Tests: Wait for the fetch to complete in active-session-collected-audio

Zaggy10241150b03833f7
diff --git a/Tests/LibWeb/Text/input/MediaSession/active-session-collected-audio.html b/Tests/LibWeb/Text/input/MediaSession/active-session-collected-audio.html
index 1c0909f2f62..e293f28d633 100644
--- a/Tests/LibWeb/Text/input/MediaSession/active-session-collected-audio.html
+++ b/Tests/LibWeb/Text/input/MediaSession/active-session-collected-audio.html
@@ -12,6 +12,9 @@ async function playAndPauseAudio() {
await paused;
while (internals.nowPlayingStateForTesting()?.playbackState !== "paused")
await new Promise(resolve => setTimeout(resolve, 0));
+ // An element that is still fetching its media can fire events, so it stays alive until the fetch finishes.
+ while (audio.networkState === HTMLMediaElement.NETWORK_LOADING)
+ await new Promise(resolve => setTimeout(resolve, 0));
println(`paused audio keeps session: ${internals.activeMediaSessionState() !== null}`);
const weakAudio = new WeakRef(audio);
audio = null;