diff --git a/235224.patch b/235224.patch new file mode 100644 index 0000000..8a2d132 --- /dev/null +++ b/235224.patch @@ -0,0 +1,84 @@ +From e96d49ab11690752382f3b84739e3097aa539105 Mon Sep 17 00:00:00 2001 +From: Pablo Saavedra +Date: Wed, 30 Mar 2022 07:41:37 +0000 +Subject: [PATCH] [GTK][WPE] Exit cleanly if Connection to UIProcess severed. + Regression (r214307) https://bugs.webkit.org/show_bug.cgi?id=235224 + +This patch reverts the WPE and GTK specific code removed in '[WK2] Make +establishing a connection between the WebProcess and the Network process more +robust' (r12345): + +GTK+ and WPE ports don't exit on send sync message failure. In those particular +cases, the network process can be terminated by the UI process while the +Web process is still initializing, so we always want to exit instead of crashing. This can +happen when the WebView is created and then destroyed quickly. +See https://bugs.webkit.org/show_bug.cgi?id=183348. + +Reviewed by Carlos Garcia Campos. + +* WebProcess/WebProcess.cpp: +(WebKit::getNetworkProcessConnection): +(WebKit::WebProcess::getGPUProcessConnection): +(WebKit::getWebAuthnProcessConnection): + + + +Canonical link: https://commits.webkit.org/249019@main +git-svn-id: https://svn.webkit.org/repository/webkit/trunk@292099 268f45cc-cd09-0410-ab3c-d52691b4dbfc +--- + Source/WebKit/ChangeLog | 22 ++++++++++++++++++++++ + Source/WebKit/WebProcess/WebProcess.cpp | 20 +++++++++++++++++--- + 2 files changed, 39 insertions(+), 3 deletions(-) + +diff --git a/Source/WebKit/WebProcess/WebProcess.cpp b/Source/WebKit/WebProcess/WebProcess.cpp +index 79d179039303..272105032407 100644 +--- a/Source/WebKit/WebProcess/WebProcess.cpp ++++ b/Source/WebKit/WebProcess/WebProcess.cpp +@@ -1127,6 +1127,20 @@ void WebProcess::setInjectedBundleParameters(const IPC::DataReference& value) + injectedBundle->setBundleParameters(value); + } + ++NO_RETURN inline void failedToSendSyncMessage() ++{ ++#if PLATFORM(GTK) || PLATFORM(WPE) ++ // GTK and WPE ports don't exit on send sync message failure. ++ // In this particular case, the network process can be terminated by the UI process while the ++ // Web process is still initializing, so we always want to exit instead of crashing. This can ++ // happen when the WebView is created and then destroyed quickly. ++ // See https://bugs.webkit.org/show_bug.cgi?id=183348. ++ exit(0); ++#else ++ CRASH(); ++#endif ++} ++ + static NetworkProcessConnectionInfo getNetworkProcessConnection(IPC::Connection& connection) + { + NetworkProcessConnectionInfo connectionInfo; +@@ -1146,7 +1160,7 @@ static NetworkProcessConnectionInfo getNetworkProcessConnection(IPC::Connection& + unsigned failedAttempts = 0; + while (!requestConnection()) { + if (++failedAttempts >= maxFailedAttempts) +- CRASH(); ++ failedToSendSyncMessage(); + + RELEASE_LOG_ERROR(Process, "getNetworkProcessConnection: Failed to get connection to network process, will retry..."); + +@@ -1299,7 +1313,7 @@ GPUProcessConnectionInfo WebProcess::getGPUProcessConnection(IPC::Connection& co + // If we failed the first time, retry once. The attachment may have become invalid + // before it was received by the web process if the network process crashed. + if (!connection.sendSync(Messages::WebProcessProxy::GetGPUProcessConnection(parameters), Messages::WebProcessProxy::GetGPUProcessConnection::Reply(connectionInfo), 0)) +- CRASH(); ++ failedToSendSyncMessage(); + } + + return connectionInfo; +@@ -1384,7 +1398,7 @@ static WebAuthnProcessConnectionInfo getWebAuthnProcessConnection(IPC::Connectio + // before it was received by the web process if the network process crashed. + if (!connection.sendSync(Messages::WebProcessProxy::GetWebAuthnProcessConnection(), Messages::WebProcessProxy::GetWebAuthnProcessConnection::Reply(connectionInfo), 0)) { + RELEASE_LOG_ERROR(WebAuthn, "getWebAuthnProcessConnection: Unable to connect to WebAuthn process (Terminating)"); +- CRASH(); ++ failedToSendSyncMessage(); + } + } + diff --git a/webkit2gtk3.spec b/webkit2gtk3.spec index c4afec2..7a70f2a 100644 --- a/webkit2gtk3.spec +++ b/webkit2gtk3.spec @@ -29,6 +29,9 @@ Source1: https://webkitgtk.org/releases/webkitgtk-%{version}.tar.xz.asc # $ gpg --export --export-options export-minimal D7FCF61CF9A2DEAB31D81BD3F3D322D0EC4582C3 5AA3BC334FD7E3369E7C77B291C559DBE4C9123B > webkitgtk-keys.gpg Source2: webkitgtk-keys.gpg +# https://bugs.webkit.org/show_bug.cgi?id=235224 +Patch0: 235224.patch + BuildRequires: bison BuildRequires: bubblewrap BuildRequires: cmake