Files
ladybird/Libraries/LibWeb/Worker/WebWorkerClient.ipc
Aliaksandr Kalenik 737691c43a LibWeb: Keep worker startup reachable until script load completes
Fixes flakiness in worker tests that create a Worker or SharedWorker
with a missing script URL and only attach an error handler to it.
Once the test callback returns, nothing keeps the worker rooted from
JavaScript. If GC ran before the WebWorker process reported the
script fetch failure, the Worker/WorkerAgentParent cycle could be
collected and the error event never delivered, leaving the test hung
until timeout.

Hold startup-pending WorkerAgentParents from the outside
EnvironmentSettingsObject and release that edge once the script load
succeeds, fails, or the worker closes. The worker now survives long
enough to deliver its first script-load result.
2026-04-27 18:02:49 +02:00

16 lines
789 B
Plaintext

#include <LibHTTP/Cookie/Cookie.h>
#include <LibIPC/TransportHandle.h>
#include <LibURL/URL.h>
#include <LibWeb/Bindings/AgentType.h>
#include <LibWeb/HTML/BroadcastChannelMessage.h>
endpoint WebWorkerClient {
did_close_worker() =|
did_finish_loading_worker_script() =|
did_fail_loading_worker_script() =|
did_report_worker_exception(String message, String filename, u32 lineno, u32 colno) =|
did_request_cookie(URL::URL url, HTTP::Cookie::Source source) => (HTTP::Cookie::VersionedCookie cookie)
did_post_broadcast_channel_message(Web::HTML::BroadcastChannelMessage message) =|
request_worker_agent(Web::Bindings::AgentType worker_type) => (IPC::TransportHandle handle, IPC::TransportHandle request_server_handle, IPC::TransportHandle image_decoder_handle)
}