Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 0f81719cec3c6628bef8bfb675340ae4e3726b7e
      
https://github.com/WebKit/WebKit/commit/0f81719cec3c6628bef8bfb675340ae4e3726b7e
  Author: Wenson Hsieh <[email protected]>
  Date:   2025-05-24 (Sat, 24 May 2025)

  Changed paths:
    M Source/WebKit/Platform/Logging.h
    M Source/WebKit/UIProcess/mac/WebPageProxyMac.mm
    M Source/WebKit/UIProcess/mac/WebViewImpl.mm
    M Tools/TestWebKitAPI/Tests/WebKitCocoa/CopyHTML.mm

  Log Message:
  -----------
  [macOS] Mitigate sync IPC hangs under 
WebViewImpl::writeSelectionToPasteboard()
https://bugs.webkit.org/show_bug.cgi?id=293521
rdar://151923464

Reviewed by Aditya Keerthi and Abrar Rahman Protyasha.

Mitigate hangs due to synchronous IPC, when calling into 
`WebViewImpl::writeSelectionToPasteboard()`
to write selected text onto the system pasteboard. This codepath is invoked by 
system services
through the `NSServicesMenuRequestor` protocol, and must be performed 
synchronously; to mitigate
hangs due to the web process being unresponsive, we make a couple of 
adjustments:

1.  Early return with empty string/null data in the case where there is no 
ranged selection in the
    focused or main frame; this avoids the need for any sync IPC, in the common 
case.

2.  Lower the sync IPC timeout from 20 seconds to 5 seconds (which is more 
consistent with most
    other sync IPC timeouts).

* Source/WebKit/Platform/Logging.h:
* Source/WebKit/UIProcess/mac/WebPageProxyMac.mm:
(WebKit::WebPageProxy::stringSelectionForPasteboard):
(WebKit::WebPageProxy::dataSelectionForPasteboard):
* Source/WebKit/UIProcess/mac/WebViewImpl.mm:
(WebKit::WebViewImpl::writeSelectionToPasteboard):

Additionally add logging to make it a bit easier to diagnose and debug issues 
where we're hanging
underneath these sync IPC codepaths.

* Tools/TestWebKitAPI/Tests/WebKitCocoa/CopyHTML.mm:
(TEST(CopyHTML, WriteRichTextSelectionToPasteboard)):

Adjust this API test to copy HTML after waiting for at least 1 presentation 
update, to ensure that
the UI-side `EditorState` is up to date.

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to