Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 5db7057e3b2f627f2d8df8f8af1a98ed3a89272e
https://github.com/WebKit/WebKit/commit/5db7057e3b2f627f2d8df8f8af1a98ed3a89272e
Author: Carlos Garcia Campos <[email protected]>
Date: 2024-07-11 (Thu, 11 Jul 2024)
Changed paths:
M Source/WebKit/Platform/IPC/Connection.h
M Source/WebKit/UIProcess/WebPasteboardProxy.h
M Source/WebKit/UIProcess/gtk/Clipboard.h
M Source/WebKit/UIProcess/gtk/ClipboardGtk3.cpp
M Source/WebKit/UIProcess/gtk/ClipboardGtk4.cpp
M Source/WebKit/UIProcess/gtk/WebPasteboardProxyGtk.cpp
Log Message:
-----------
[GTK4] Ensure that clipboard read operations work synchronously
https://bugs.webkit.org/show_bug.cgi?id=265088
Reviewed by Alejandro G. Castro.
When running layout tests clipboard operations are usually
triggered by an injected bundle synchronous message from
the web process to the UI process. Pasteboard operations are
also handled using synchronous IPC messages, but GTK4 clipboard
reads are asynchronous, and this can easily cause deadlocks.
This can happen, for example, when the test calls
testRunner.execCommand("Paste"),
which is implemented as a synchronous injected bundle message.
The UI process receives the message that ends up calling
WKPageExecuteCommandForTesting,
which sends a synchronous message with reply to the web process. The web
process then handles the paste editing command asking the UI process
pasteboard sending another synchronous API message. In the UI process
a clipboard request is started, but the GdkClipboard GTask can't finish
because the run loop is blocked by the initial injected bundle message
that is waiting to provide a reply. This works if we can reply to the
pasteboard request synchronously, by running a nested main loop that
allows the GdkClipboard GTask to complete in an idle.
Running nested main loops can be dangerous, but we only need to do that
when a pasteboard read request is done while already dispatching a
synchronous message, which probably only happens in tests.
This fixes many pasteboard tests that are timing out only when running
on GTK4 builds.
Co-authored-by: Claudio Saavedra <[email protected]>
* Source/WebKit/Platform/IPC/Connection.h:
(IPC::Connection::inDispatchSyncMessageCount const):
* Source/WebKit/UIProcess/WebPasteboardProxy.h:
* Source/WebKit/UIProcess/gtk/Clipboard.h:
* Source/WebKit/UIProcess/gtk/ClipboardGtk3.cpp:
(WebKit::Clipboard::readText):
(WebKit::Clipboard::readFilePaths):
(WebKit::Clipboard::readURL):
(WebKit::Clipboard::readBuffer):
* Source/WebKit/UIProcess/gtk/ClipboardGtk4.cpp:
(WebKit::Clipboard::readText):
(WebKit::Clipboard::readFilePaths):
(WebKit::Clipboard::readBuffer):
(WebKit::Clipboard::readURL):
(WebKit::ReadTextAsyncData::ReadTextAsyncData): Deleted.
(WebKit::ReadFilePathsAsyncData::ReadFilePathsAsyncData): Deleted.
(WebKit::ReadBufferAsyncData::ReadBufferAsyncData): Deleted.
(WebKit::ReadURLAsyncData::ReadURLAsyncData): Deleted.
* Source/WebKit/UIProcess/gtk/WebPasteboardProxyGtk.cpp:
(WebKit::WebPasteboardProxy::readText):
(WebKit::WebPasteboardProxy::readFilePaths):
(WebKit::WebPasteboardProxy::readBuffer):
(WebKit::WebPasteboardProxy::typesSafeForDOMToReadAndWrite):
(WebKit::WebPasteboardProxy::readURLFromPasteboard):
(WebKit::WebPasteboardProxy::readBufferFromPasteboard):
Canonical link: https://commits.webkit.org/280852@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