ladybird/Libraries/LibWeb/Worker/WebWorkerServer.ipc
Aliaksandr Kalenik 1b5bdb2b41 LibWeb+LibWebView+WebWorker: Initialize transport peer pid on Windows
WebWorker control connections can transfer handles from the browser
process to the worker process, including RequestServer and ImageDecoder
transport handles sent during worker startup. On Windows, serializing
those attachments needs the destination process id so DuplicateHandle
and WSADuplicateSocketW can target the peer process. WebWorker was
excluded from the generic helper-process InitTransport handshake,
leaving the transport without a peer pid before any attachment-bearing
message was sent.

Add InitTransport to the WebWorker server endpoint, implement the
server-side peer pid exchange, expose the message type through
WebWorkerClient, and let the shared helper launcher perform the
handshake for workers as it does for other Windows IPC clients.
2026-06-18 04:06:30 +02:00

38 lines
1.7 KiB
Text

#include <LibURL/URL.h>
#include <LibIPC/File.h>
#include <LibIPC/TransportHandle.h>
#include <LibWeb/Bindings/AgentType.h>
#include <LibWeb/HTML/BroadcastChannelMessage.h>
#include <LibWeb/Bindings/Worker.h>
#include <LibWeb/HTML/StructuredSerialize.h>
#include <LibWeb/HTML/Scripting/SerializedEnvironmentSettingsObject.h>
#include <LibWeb/HTML/WorkerAgentTypes.h>
endpoint WebWorkerServer {
init_transport(int peer_pid) => (int peer_pid)
connect_to_request_server(IPC::TransportHandle handle) =|
connect_to_image_decoder(IPC::TransportHandle handle) =|
start_worker(URL::URL url,
Web::Bindings::WorkerType type,
Web::Bindings::RequestCredentials credentials,
String name,
Web::HTML::TransferDataEncoder message_port,
Web::HTML::SerializedEnvironmentSettingsObject outside_settings,
Web::Bindings::AgentType agent_type) =|
connect_shared_worker(Web::HTML::TransferDataEncoder message_port,
Web::HTML::SerializedEnvironmentSettingsObject outside_settings) =|
close_worker() =|
did_worker_agent_finish_loading_script(Web::HTML::WorkerAgentOwnerToken owner_token) =|
did_worker_agent_fail_loading_script(Web::HTML::WorkerAgentOwnerToken owner_token) =|
did_worker_agent_report_exception(Web::HTML::WorkerAgentOwnerToken owner_token, String message, String filename, u32 lineno, u32 colno) =|
did_worker_agent_close(Web::HTML::WorkerAgentOwnerToken owner_token) =|
broadcast_channel_message(Web::HTML::BroadcastChannelMessage message) =|
handle_file_return(i32 error, Optional<IPC::File> file, i32 request_id) =|
}