Skip to content
Browse files
Avoid extracting the main video in element fullscreen when fullscreen…
… mode isn't active

Reviewed by Eric Carlson.

Add a check that we're actually still in element fullscreen before extracting the main video. Since
`WebFullScreenManager` and its `m_element` both persist after exiting fullscreen mode, there's
currently nothing preventing us from re-triggering video extraction when a video is paused once
again outside of fullscreen mode.

Covered by a new API test (more details in the bug).

* Source/WebKit/WebProcess/FullScreen/WebFullScreenManager.cpp:

Deal with another corner case, wherein the main video element we previously detected may no longer
be in the fullscreen element's subtree by the time that the extraction timer fires. To avoid this,
always update the main video element again when the extraction timer is fired (as long as we're
still in fullscreen mode), before proceeding with extraction.

Canonical link:
git-svn-id: 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
whsieh committed May 25, 2022
1 parent ea0448d commit 6abda06fc8d1983c4f14e1f63097e9d88797525e
Showing 1 changed file with 10 additions and 1 deletion.
@@ -374,7 +374,11 @@ void WebFullScreenManager::handleEvent(WebCore::ScriptExecutionContext& context,
RefPtr targetElement = dynamicDowncast<WebCore::Element>(event.currentTarget());
if (!m_element || &context != &m_element->document() || !targetElement)
if (!m_element || !targetElement)

Ref document = m_element->document();
if (&context != document.ptr() || !document->fullscreenManager().isFullscreen())

if (targetElement == m_element) {
@@ -398,6 +402,11 @@ void WebFullScreenManager::handleEvent(WebCore::ScriptExecutionContext& context,

void WebFullScreenManager::mainVideoElementExtractionTimerFired()
if (!m_element || !m_element->document().fullscreenManager().isFullscreen())


if (!m_mainVideoElement)

0 comments on commit 6abda06

Please sign in to comment.