[webkit-changes] [WebKit/WebKit] 35716b: [iOS] With media capability grants enabled, unable...

aestes noreply at github.com
Tue Jan 9 17:28:28 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 35716bf5f66cdd27a4b72d9c7a3ef8317c77a932
      https://github.com/WebKit/WebKit/commit/35716bf5f66cdd27a4b72d9c7a3ef8317c77a932
  Author: Andy Estes <aestes at apple.com>
  Date:   2024-01-09 (Tue, 09 Jan 2024)

  Changed paths:
    M Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml
    M Source/WebKit/Platform/cocoa/MediaCapability.h
    M Source/WebKit/Platform/cocoa/MediaCapability.mm
    M Source/WebKit/UIProcess/Cocoa/WebPageProxyCocoa.mm
    M Source/WebKit/UIProcess/WebPageProxy.cpp
    M Source/WebKit/UIProcess/WebProcessPool.cpp

  Log Message:
  -----------
  [iOS] With media capability grants enabled, unable to activate camera or mic on bing.com
https://bugs.webkit.org/show_bug.cgi?id=267296
rdar://120510826

Reviewed by Jer Noble and Per Arne Vollan.

Prior to this change, WebKit would create a media capability each time the main frame navigates to a
new registrable domain and grant it to the page's WebContent and GPU processes. Later, when the page
began playback or capture, WebKit would activate the capability. Granting and activating in this
order exposed a bug in iOS where other parts of the system would not detect the activated
capability, leading to failures to activate the camera and microphone (among other issues).

To work around this bug, this change reverses the order of operations. WebKit now creates a new
capability per top frame navigation and defers granting it until it is activated.

* Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml:
Re-activated the media capabilities feature by default.

* Source/WebKit/Platform/cocoa/MediaCapability.h:
* Source/WebKit/Platform/cocoa/MediaCapability.mm:
(WebKit::createPlatformCapability):
(WebKit::MediaCapability::MediaCapability):
(WebKit::MediaCapability::isActivatingOrActive const):
(WebKit::MediaCapability::registrableDomain const):
(WebKit::MediaCapability::environmentIdentifier const):
Changed to hold a URL and vend a RegistrableDomain on demand. This was necessary because we now must
re-create and re-grant the capability per top frame navigation, so it's insufficient to compare an
existing media capability to the page's current URL by registrable domain. Drive-by fix: made the
class non-copyable.

* Source/WebKit/UIProcess/Cocoa/WebPageProxyCocoa.mm:
(WebKit::WebPageProxy::setMediaCapability):
(WebKit::WebPageProxy::updateMediaCapability):
(WebKit::WebPageProxy::shouldDeactivateMediaCapability const):
Changed the logic to re-create media capabilities per top frame navigation and defer granting them
to the WebContent and GPU processes until they are activated.

* Source/WebKit/UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::gpuProcessDidFinishLaunching):
Because the process will finish launching before playback or capture is active, it's not safe to
grant the capability immediately. Instead, called updateMediaCapability, which will only grant the
capability if activated.

* Source/WebKit/UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::processDidFinishLaunching):
Ditto.

Canonical link: https://commits.webkit.org/272833@main




More information about the webkit-changes mailing list