[webkit-changes] [WebKit/WebKit] fad8a7: Prevent frontmost tab from suspending if it has ve...

bnham noreply at github.com
Wed Feb 12 09:18:50 PST 2025


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: fad8a7409a4ca19ee6b14b6d324184d37b694ae8
      https://github.com/WebKit/WebKit/commit/fad8a7409a4ca19ee6b14b6d324184d37b694ae8
  Author: Ben Nham <nham at apple.com>
  Date:   2025-02-12 (Wed, 12 Feb 2025)

  Changed paths:
    M Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivateForTesting.h
    M Source/WebKit/UIProcess/API/Cocoa/WKWebViewTesting.mm
    M Source/WebKit/UIProcess/WebPageProxy.cpp
    M Source/WebKit/UIProcess/WebPageProxy.h
    M Source/WebKit/UIProcess/WebProcessActivityState.cpp
    M Source/WebKit/UIProcess/WebProcessActivityState.h
    M Source/WebKit/UIProcess/mac/WebViewImpl.mm
    M Tools/TestWebKitAPI/Tests/WebKit/EnableAccessibility.mm

  Log Message:
  -----------
  Prevent frontmost tab from suspending if it has vended a remote accessibility element
https://bugs.webkit.org/show_bug.cgi?id=287530
rdar://142642077

Reviewed by Per Arne Vollan.

We are seeing some hangs in accessibility clients that are trying to capture a snapshot of the
accessibility hierarchy of a Safari window. This occurs if the window is occluded or hidden, which
makes the frontmost tab's web content eligible for suspension. When the WKWebView associated with
the frontmost tab is backed by a suspended WebContent process, the IPC to acquire the AX hierarchy
in the suspended WebContent process hangs forever.

To work around this, if a client ever asks for the the AX children of a WKWebView, we acquire a
background activity to prevent suspension of the associated page as long as it's in a window. This
fixes the most common case of hangs in where a client tries to recursively snapshot the AX hierarchy
of an occluded or hidden Safari window.

* Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivateForTesting.h:
* Source/WebKit/UIProcess/API/Cocoa/WKWebViewTesting.mm:
(-[WKWebView _hasAccessibilityActivityForTesting]):
* Source/WebKit/UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::takeAccessibilityActivityWhenInWindow):
(WebKit::WebPageProxy::hasAccessibilityActivityForTesting):
(WebKit::WebPageProxy::viewDidLeaveWindow):
(WebKit::WebPageProxy::viewDidEnterWindow):
* Source/WebKit/UIProcess/WebPageProxy.h:
* Source/WebKit/UIProcess/WebProcessActivityState.cpp:
(WebKit::WebProcessActivityState::takeAccessibilityActivityWhenInWindow):
(WebKit::WebProcessActivityState::takeAccessibilityActivity):
(WebKit::WebProcessActivityState::hasAccessibilityActivityForTesting const):
(WebKit::WebProcessActivityState::viewDidEnterWindow):
(WebKit::WebProcessActivityState::viewDidLeaveWindow):
* Source/WebKit/UIProcess/WebProcessActivityState.h:
* Source/WebKit/UIProcess/mac/WebViewImpl.mm:
(WebKit::WebViewImpl::accessibilityAttributeValue):
* Tools/TestWebKitAPI/Tests/WebKit/EnableAccessibility.mm:
(TEST(WebKit, AccessibilityChildrenPreventsProcessSuspensionOnFrontmostTab)):

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



To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications


More information about the webkit-changes mailing list