1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 19:27:44 +00:00

WebSocket: Avoid unnecessary IPC::Dictionary wrapper

We already have and use HashMap<DeprecatedString, DeprecatedString>
nearly everywhere, which is equivalent.
This commit is contained in:
Ben Wiederhake 2023-05-14 23:04:47 +02:00 committed by Andreas Kling
parent 9b9a38ec81
commit d030f0fe9b
4 changed files with 8 additions and 8 deletions

View file

@ -16,10 +16,10 @@ WebSocketClient::WebSocketClient(NonnullOwnPtr<Core::LocalSocket> socket)
RefPtr<WebSocket> WebSocketClient::connect(const URL& url, DeprecatedString const& origin, Vector<DeprecatedString> const& protocols, Vector<DeprecatedString> const& extensions, HashMap<DeprecatedString, DeprecatedString> const& request_headers)
{
IPC::Dictionary header_dictionary;
for (auto& it : request_headers)
header_dictionary.add(it.key, it.value);
auto connection_id = IPCProxy::connect(url, origin, protocols, extensions, header_dictionary);
auto headers_or_error = request_headers.clone();
if (headers_or_error.is_error())
return nullptr;
auto connection_id = IPCProxy::connect(url, origin, protocols, extensions, headers_or_error.release_value());
if (connection_id < 0)
return nullptr;
auto connection = WebSocket::create_from_id({}, *this, connection_id);