[Site Isolation] Fix TestWebKitAPI.WKWebsiteDataStore.* tests#69419
Draft
szewai wants to merge 1 commit into
Draft
[Site Isolation] Fix TestWebKitAPI.WKWebsiteDataStore.* tests#69419szewai wants to merge 1 commit into
szewai wants to merge 1 commit into
Conversation
https://bugs.webkit.org/show_bug.cgi?id=319420 rdar://182245093 Reviewed by NOBODY (OOPS!). Tests like WKWebsiteDataStore.ListIdentifiers is failing under Site Isolation because WebProcessProxy is still alive after WebPageProxy is closed, holding WebsiteDataStore and thus NetworkProcessProxy alive. This is a leak because web process or network process should exit when clients close all WKWebViews. Investigation indicates the reference chain is: AudioHardwareListener / AudioSession => RemoteMediaSessionManagerProxy => WebProcessProxy. So the bug is RemoteMediaSessionManagerProxy registers itself as global singleton AudioSession::sharedAudioSession() (which is a strong ref) when is is being created by WebPageProxy, but it does not clear the reference when WebPageProxy is closed. This causes leakage of WebProcessProxy (and other objects) as RemoteMediaSessionManagerProxy holds strong ref to WebProcessProxy. To fix this leak, add AudioSession::clearSharedSession() and call it from a new RemoteMediaSessionManagerProxy::invalidate(), which runs both from the destructor and from WebPageProxy::resetState() when the manager is torn down ahead of a process swap, breaking the cycle before the swap can strand a live process reference. Also, stop caching a strong Ref<WebProcessProxy> in RemoteMediaSessionManagerProxy and instead derive the process on demand from the page's WeakPtr, matching how the sibling proxies (WebFullScreenManagerProxy, VideoPresentationManagerProxy, PlaybackSessionManagerProxy) already do it. This removes the last strong ref to WebProcessProxy the manager was holding. * Source/WebCore/platform/audio/AudioSession.cpp: (WebCore::AudioSession::clearSharedSession): * Source/WebCore/platform/audio/AudioSession.h: * Source/WebKit/UIProcess/Media/RemoteMediaSessionManagerProxy.cpp: (WebKit::currentAudioHardwareListenerCreator): (WebKit::RemoteMediaSessionManagerProxy::RemoteMediaSessionManagerProxy): (WebKit::RemoteMediaSessionManagerProxy::~RemoteMediaSessionManagerProxy): (WebKit::RemoteMediaSessionManagerProxy::invalidate): (WebKit::RemoteMediaSessionManagerProxy::process const): (WebKit::RemoteMediaSessionManagerProxy::messageSenderConnection const): (WebKit::RemoteMediaSessionManagerProxy::sharedPreferencesForWebProcess const): * Source/WebKit/UIProcess/Media/RemoteMediaSessionManagerProxy.h: (WebKit::RemoteMediaSessionManagerProxy::process const): Deleted. * Source/WebKit/UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::resetState):
Collaborator
|
EWS run on current version of this PR (hash b8ecb32) Details |
Collaborator
macOS Safer C++ Build #120889 (b8ecb32)❌ Found 1 failing file with 3 issues. Please address these issues before landing. See WebKit Guidelines for Safer C++ Programming. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🛠 vision-apple
b8ecb32
b8ecb32