mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-19 15:32:31 +00:00
LibWeb+WebWorker: Create SharedWorkerGlobalScope for Shared Workers
Also push the onconnect event for the initial connection. This still doesn't properly handle sending an onconnect event to a pre-existing SharedWorkerGlobalScope with the same name for the same origin, but it does give us a lot of WPT passes in the SharedWorker category.
This commit is contained in:
parent
978a3b7321
commit
4d039fc3d4
Notes:
github-actions[bot]
2025-05-18 23:51:04 +00:00
Author: https://github.com/ADKaster
Commit: 4d039fc3d4
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4806
Reviewed-by: https://github.com/shannonbooth
Reviewed-by: https://github.com/trflynn89
11 changed files with 88 additions and 39 deletions
|
@ -14,8 +14,9 @@ namespace Web::HTML {
|
|||
|
||||
GC_DEFINE_ALLOCATOR(WorkerAgentParent);
|
||||
|
||||
WorkerAgentParent::WorkerAgentParent(URL::URL url, WorkerOptions const& options, GC::Ptr<MessagePort> outside_port, GC::Ref<EnvironmentSettingsObject> outside_settings)
|
||||
WorkerAgentParent::WorkerAgentParent(URL::URL url, WorkerOptions const& options, GC::Ptr<MessagePort> outside_port, GC::Ref<EnvironmentSettingsObject> outside_settings, Bindings::AgentType agent_type)
|
||||
: m_worker_options(options)
|
||||
, m_agent_type(agent_type)
|
||||
, m_url(move(url))
|
||||
, m_outside_port(outside_port)
|
||||
, m_outside_settings(outside_settings)
|
||||
|
@ -34,7 +35,7 @@ void WorkerAgentParent::initialize(JS::Realm& realm)
|
|||
|
||||
// NOTE: This blocking IPC call may launch another process.
|
||||
// If spinning the event loop for this can cause other javascript to execute, we're in trouble.
|
||||
auto worker_socket_file = Bindings::principal_host_defined_page(realm).client().request_worker_agent(Bindings::AgentType::DedicatedWorker);
|
||||
auto worker_socket_file = Bindings::principal_host_defined_page(realm).client().request_worker_agent(m_agent_type);
|
||||
|
||||
auto worker_socket = MUST(Core::LocalSocket::adopt_fd(worker_socket_file.take_fd()));
|
||||
MUST(worker_socket->set_blocking(true));
|
||||
|
@ -44,7 +45,7 @@ void WorkerAgentParent::initialize(JS::Realm& realm)
|
|||
|
||||
m_worker_ipc = make_ref_counted<WebWorkerClient>(move(transport));
|
||||
|
||||
m_worker_ipc->async_start_dedicated_worker(m_url, m_worker_options.type, m_worker_options.credentials, m_worker_options.name, move(data_holder), m_outside_settings->serialize());
|
||||
m_worker_ipc->async_start_worker(m_url, m_worker_options.type, m_worker_options.credentials, m_worker_options.name, move(data_holder), m_outside_settings->serialize(), m_agent_type);
|
||||
}
|
||||
|
||||
void WorkerAgentParent::visit_edges(Cell::Visitor& visitor)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue