-
Notifications
You must be signed in to change notification settings - Fork 1.7k
getUserMedia camera stream lost on history pushState in iOS 17.4 Beta 4 #24971
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
getUserMedia camera stream lost on history pushState in iOS 17.4 Beta 4 #24971
Conversation
|
EWS run on previous version of this PR (hash 99fe242)
|
99fe242 to
ef4db42
Compare
|
EWS run on previous version of this PR (hash ef4db42)
|
ef4db42 to
0d35585
Compare
|
EWS run on current version of this PR (hash 0d35585)
|
youennf
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
This is a preexisting issue but I wonder whether we should create (not in this patch) MediaCapability at the time we need it (for instance when starting to capture).
This might be more difficult for non capture related stuff.
We likely could do this, but there isn't much harm in creating the MediaCapability eagerly. It simplifies the logic for ensuring the environment is propagated to the GPU process prior to creating an AVCaptureSession, and creating a MediaCapability in the deactivated state isn't expensive. |
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
0d35585 to
d97f5a0
Compare
|
Committed 275244@main (d97f5a0): https://commits.webkit.org/275244@main Reviewed commits have been landed. Closing PR #24971 and removing active labels. |
d97f5a0
0d35585