Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 3d1769871dc6bb07eaf1564f65a02de6611ed47f
https://github.com/WebKit/WebKit/commit/3d1769871dc6bb07eaf1564f65a02de6611ed47f
Author: Per Arne Vollan <[email protected]>
Date: 2026-09-11 (Fri, 11 Sep 2026)
Changed paths:
M Source/WebCore/history/CachedPage.cpp
M Tools/TestWebKitAPI/Tests/WebKit/WKWebView/SiteIsolation.mm
Log Message:
-----------
Back navigation fails to restore website after playing an embedded
cross-origin YouTube video
https://bugs.webkit.org/show_bug.cgi?id=323697
rdar://185123184
Reviewed by Sihui Liu.
CachedPage::restore() returned early when focusController().focusedOrMainFrame()
was null, which is always the case in an out-of-process iframe's process: that
page's main frame is a RemoteFrame, so the focus controller has no local frame
to
operate on. The early return skipped everything after the focus restoration,
including
firePageShowEvent(). That is what calls
Document::setVisibilityHiddenDueToDismissal(false) on each restored document,
and
that flag alone makes Document::visibilityState() report Hidden - so a restored
cross-origin iframe reported itself permanently hidden even though its page was
visible, and never got a pageshow event either.
HTMLMediaElement caches whether it is hidden in m_elementIsHidden. Once that
latched true, it pushed setPageIsVisible(false) to the player;
MediaPlayerPrivateMediaSourceAVFObjC::updateRendererVisibility() then took
acceleratedRenderingStateChanged() down to
renderingCanBeAcceleratedChanged(false),
and the GPU process destroyed the video renderer and its layer. Only video is
gated on visibility, so playback continued as audio only.
Make the focus restoration in CachedPage::restore() conditional instead of
returning early, so firePageShowEvent() and the rest still run when the main
frame
is remote. The m_needsUpdateContentsSize block is now
reachable with a null
localMainFrame, so guard it.
Test: Tools/TestWebKitAPI/Tests/WebKit/WKWebView/SiteIsolation.mm
* Source/WebCore/history/CachedPage.cpp:
(WebCore::CachedPage::restore):
* Tools/TestWebKitAPI/Tests/WebKit/WKWebView/SiteIsolation.mm:
(TestWebKitAPI::TEST(SiteIsolation,
BFCacheRestoredIframeIsVisibleAndFiresPageShow)):
Canonical link:
https://flagged.apple.com:443/proxy?t2=DO0J8f0ni3&o=aHR0cHM6Ly9jb21taXRzLndlYmtpdC5vcmcvMzIwOTI3QG1haW4=&emid=be5a3bb7-4839-464f-a1a1-245e08cc9e08&c=11
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications