Skip to content

Conversation

@emutavchi
Copy link
Collaborator

Sometimes applications create a <video> tag with preload="none" and then remove the element from the DOM without ever starting playback. This results in the video element being leaked, because HTMLMediaElement::virtualHasPendingActivity() retains the element while its network state is still "Loading".

Sometimes applications create a <video> tag with 'preload="none"' and
then remove the element from the DOM without ever starting
playback. This results in the video element being leaked,
because HTMLMediaElement::virtualHasPendingActivity() retains the
element while its network state is still "Loading".
@emutavchi emutavchi requested a review from philn as a code owner January 5, 2026 20:02
@modeveci modeveci requested review from eocanha and removed request for philn January 6, 2026 10:32
@eocanha eocanha added the upstream Related to an upstream bug (or should be at some point) label Jan 14, 2026
eocanha added a commit to eocanha/WebKit that referenced this pull request Jan 14, 2026
https://bugs.webkit.org/show_bug.cgi?id=305473

Reviewed by NOBODY (OOPS!).

Sometimes applications create a <video> tag with 'preload="none"' and
then remove the element from the DOM without ever starting playback.
This results in the video element being leaked, because
HTMLMediaElement::virtualHasPendingActivity() retains the element while
its network state is still "Loading".

See: WebPlatformForEmbedded/WPEWebKit#1594

This patch keeps the default behaviour of changing the NetworkState to
"Loading", except in the case of a delayed load (the case triggered by
preload="none"), in which it's set to Idle and therefore allowing the
full destruction of the video element.

Original author: Eugene Mutavchi <[email protected]>

* Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
(WebCore::MediaPlayerPrivateGStreamer::load): Reset NetworkState to Idle in case of delayed load. Set to Loading otherwise.
@eocanha
Copy link
Member

eocanha commented Jan 14, 2026

Submitted the patch for review upstream as https://bugs.webkit.org/show_bug.cgi?id=305473 / WebKit/WebKit#56561

webkit-commit-queue pushed a commit to eocanha/WebKit that referenced this pull request Jan 14, 2026
https://bugs.webkit.org/show_bug.cgi?id=305473

Reviewed by Xabier Rodriguez-Calvar.

Sometimes applications create a <video> tag with 'preload="none"' and
then remove the element from the DOM without ever starting playback.
This results in the video element being leaked, because
HTMLMediaElement::virtualHasPendingActivity() retains the element while
its network state is still "Loading".

See: WebPlatformForEmbedded/WPEWebKit#1594

This patch keeps the default behaviour of changing the NetworkState to
"Loading", except in the case of a delayed load (the case triggered by
preload="none"), in which it's set to Idle and therefore allowing the
full destruction of the video element.

Original author: Eugene Mutavchi <[email protected]>

* Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
(WebCore::MediaPlayerPrivateGStreamer::load): Reset NetworkState to Idle in case of delayed load. Set to Loading otherwise.

Canonical link: https://commits.webkit.org/305578@main
eocanha pushed a commit that referenced this pull request Jan 14, 2026
https://bugs.webkit.org/show_bug.cgi?id=305473

Reviewed by Xabier Rodriguez-Calvar.

Sometimes applications create a <video> tag with 'preload="none"' and
then remove the element from the DOM without ever starting playback.
This results in the video element being leaked, because
HTMLMediaElement::virtualHasPendingActivity() retains the element while
its network state is still "Loading".

See: #1594

This patch keeps the default behaviour of changing the NetworkState to
"Loading", except in the case of a delayed load (the case triggered by
preload="none"), in which it's set to Idle and therefore allowing the
full destruction of the video element.

Original author: Eugene Mutavchi <[email protected]>

* Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
(WebCore::MediaPlayerPrivateGStreamer::load): Reset NetworkState to Idle in case of delayed load. Set to Loading otherwise.

Canonical link: https://commits.webkit.org/305578@main
@eocanha
Copy link
Member

eocanha commented Jan 14, 2026

Patch landed upstream as WebKit/WebKit@67cc2de and backported to wpe-2.46 as 4c72cef. Closing PR.

@eocanha eocanha closed this Jan 14, 2026
eocanha pushed a commit that referenced this pull request Jan 16, 2026
https://bugs.webkit.org/show_bug.cgi?id=305473

Reviewed by Xabier Rodriguez-Calvar.

Sometimes applications create a <video> tag with 'preload="none"' and
then remove the element from the DOM without ever starting playback.
This results in the video element being leaked, because
HTMLMediaElement::virtualHasPendingActivity() retains the element while
its network state is still "Loading".

See: #1594

This patch keeps the default behaviour of changing the NetworkState to
"Loading", except in the case of a delayed load (the case triggered by
preload="none"), in which it's set to Idle and therefore allowing the
full destruction of the video element.

Original author: Eugene Mutavchi <[email protected]>

* Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
(WebCore::MediaPlayerPrivateGStreamer::load): Reset NetworkState to Idle in case of delayed load. Set to Loading otherwise.

Canonical link: https://commits.webkit.org/305578@main
@eocanha
Copy link
Member

eocanha commented Jan 16, 2026

Patch proactively backported it to wpe-2.38 as a087bcd

(See: #1580 (comment))

marcin-mielczarczyk-red pushed a commit to LibertyGlobal/WPEWebKit that referenced this pull request Jan 16, 2026
https://bugs.webkit.org/show_bug.cgi?id=305473

Reviewed by Xabier Rodriguez-Calvar.

Sometimes applications create a <video> tag with 'preload="none"' and
then remove the element from the DOM without ever starting playback.
This results in the video element being leaked, because
HTMLMediaElement::virtualHasPendingActivity() retains the element while
its network state is still "Loading".

See: WebPlatformForEmbedded#1594

This patch keeps the default behaviour of changing the NetworkState to
"Loading", except in the case of a delayed load (the case triggered by
preload="none"), in which it's set to Idle and therefore allowing the
full destruction of the video element.

Original author: Eugene Mutavchi <[email protected]>

* Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
(WebCore::MediaPlayerPrivateGStreamer::load): Reset NetworkState to Idle in case of delayed load. Set to Loading otherwise.

Canonical link: https://commits.webkit.org/305578@main
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

upstream Related to an upstream bug (or should be at some point) wpe-2.38 wpe-2.46

Development

Successfully merging this pull request may close these issues.

3 participants