Skip to content

Commit

Permalink
StreamClientConnection::trySendSyncStream should return a reply+decod…
Browse files Browse the repository at this point in the history
…er XOR an actual error

https://bugs.webkit.org/show_bug.cgi?id=258861
rdar://111722083

Reviewed by Kimmo Kinnunen.

Instead of `SendSyncResult<T> { }`, which would have no decoder and a `NoError` (an invalid combination),
an actual error should be returned.
And in case decoding the reply arguments failed, there should be an actual error as well.

* Source/WebKit/Platform/IPC/StreamClientConnection.h:
(IPC::StreamClientConnection::trySendSyncStream):

Canonical link: https://commits.webkit.org/265763@main
  • Loading branch information
squelart committed Jul 5, 2023
1 parent 821738a commit 12cb9f5
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Source/WebKit/Platform/IPC/StreamClientConnection.h
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ std::optional<StreamClientConnection::SendSyncResult<T>> StreamClientConnection:
// std::nullopt means we couldn't send through the stream, so try sending out of stream.
auto syncRequestID = m_connection->makeSyncRequestID();
if (!m_connection->pushPendingSyncRequestID(syncRequestID))
return SendSyncResult<T> { };
return { { nullptr, std::nullopt, Error::CantWaitForSyncReplies } };

auto decoderResult = [&]() -> std::optional<Connection::DecoderOrError> {
StreamConnectionEncoder messageEncoder { T::name(), span.data(), span.size() };
Expand Down Expand Up @@ -266,6 +266,8 @@ std::optional<StreamClientConnection::SendSyncResult<T>> StreamClientConnection:
*decoder >> result.replyArguments;
if (result.replyArguments)
result.decoder = WTFMove(decoder);
else
result.error = Error::FailedToDecodeReplyArguments;
} else
result.error = decoderResult->error;
return result;
Expand Down

0 comments on commit 12cb9f5

Please sign in to comment.