-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
getUserMedia camera stream lost on history pushState in iOS 17.4 Beta 4
https://bugs.webkit.org/show_bug.cgi?id=269846 rdar://123381737 Reviewed by Eric Carlson and Youenn Fablet. When WebKit adopted media capability grants for camera capture we chose to tie the lifetime of the media environment to the top frame document's current URL, such that if the URL changes (ignoring fragment identifiers) then the current media environment is destroyed and a new one is created. If a capture session is active when the media environment changes then the system will pause the capture session as it's no longer associated with the current media environment. The logic of comparing URLs was meant as a proxy for detecting cross-document navigations but failed to account for same-document navigations that changed the path of the current URL (e.g., via pushState). Since the origin associated with the media environment does not change during a same-document navigation there is no need to recreate the media environment. Addressed this by moving the logic for creating and destroying media environments to WebPageProxy::didChangeMainDocument. Further, since only the top document's origin is displayed to the user in iOS's privacy accounting UI, changed MediaCapability to only track a SecurityOrigin. The logic for when to activate and deactivate a media environment's capability remains unchanged. Manually verified that this resolves the issue reported in bug #269846. Unfortunately no new tests are possible since the underlying platform support for media capabilities is not available in iOS Simulator. * Source/WebKit/Platform/cocoa/MediaCapability.h: * Source/WebKit/Platform/cocoa/MediaCapability.mm: (WebKit::MediaCapability::MediaCapability): (WebKit::m_mediaEnvironment): (WebKit::MediaCapability::registrableDomain const): Deleted. * Source/WebKit/UIProcess/Cocoa/WebPageProxyCocoa.mm: (WebKit::WebPageProxy::setMediaCapability): (WebKit::WebPageProxy::deactivateMediaCapability): (WebKit::WebPageProxy::resetMediaCapability): (WebKit::WebPageProxy::updateMediaCapability): * Source/WebKit/UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::didCommitLoadForFrame): (WebKit::WebPageProxy::didChangeMainDocument): * Source/WebKit/UIProcess/WebPageProxy.h: * Source/WebKit/WebKit.xcodeproj/project.pbxproj: Canonical link: https://commits.webkit.org/275244@main
- Loading branch information
Showing
6 changed files
with
57 additions
and
45 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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