Files
ladybird/Libraries/LibWeb/Worker/WebWorkerClient.h
CountBleck 6a109c5c57 LibWeb: Allow workers to be spawned by other workers
This commit provides IPC endpoint to WebWorker processes that allows new
WebWorker processes to be requested (just like what WebContent has).
This is implemented by proxying the request_worker_agent call from
WebWorker through WebContent to LibWebView. This allows the WPT test...
http://wpt.live/referrer-policy/gen/worker-classic.http-rp/unsafe-url/worker-classic.http.html
...to pass, and the same is likely true for similar tests.
2026-01-31 22:45:08 +01:00

40 lines
1.2 KiB
C++

/*
* Copyright (c) 2023, Andrew Kaster <akaster@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <LibIPC/ConnectionToServer.h>
#include <LibWeb/Cookie/Cookie.h>
#include <LibWeb/Export.h>
#include <LibWeb/Worker/WebWorkerClientEndpoint.h>
#include <LibWeb/Worker/WebWorkerServerEndpoint.h>
namespace Web::HTML {
class WEB_API WebWorkerClient final
: public IPC::ConnectionToServer<WebWorkerClientEndpoint, WebWorkerServerEndpoint>
, public WebWorkerClientEndpoint {
C_OBJECT_ABSTRACT(WebWorkerClient);
public:
explicit WebWorkerClient(NonnullOwnPtr<IPC::Transport>);
virtual void did_close_worker() override;
virtual Messages::WebWorkerClient::DidRequestCookieResponse did_request_cookie(URL::URL, Cookie::Source) override;
virtual Messages::WebWorkerClient::RequestWorkerAgentResponse request_worker_agent(Web::Bindings::AgentType worker_type) override;
Function<void()> on_worker_close;
Function<String(URL::URL const&, Cookie::Source)> on_request_cookie;
Function<IPC::File(Web::Bindings::AgentType)> on_request_worker_agent;
IPC::File clone_transport();
private:
virtual void die() override;
};
}