1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 13:18:13 +00:00

LibWeb: Serialize and pass to the WebWorker the current ESO

This allows the initial fetch() in the run a worker AO to use the proper
values from the outside settings.
This commit is contained in:
Andrew Kaster 2024-03-05 09:42:10 -07:00 committed by Andreas Kling
parent 4d22358e05
commit b5acc5f2df
12 changed files with 92 additions and 13 deletions

View file

@ -13,10 +13,11 @@ namespace Web::HTML {
JS_DEFINE_ALLOCATOR(WorkerAgent);
WorkerAgent::WorkerAgent(URL url, WorkerOptions const& options, JS::GCPtr<MessagePort> outside_port)
WorkerAgent::WorkerAgent(URL url, WorkerOptions const& options, JS::GCPtr<MessagePort> outside_port, JS::NonnullGCPtr<EnvironmentSettingsObject> outside_settings)
: m_worker_options(options)
, m_url(move(url))
, m_outside_port(outside_port)
, m_outside_settings(outside_settings)
{
}
@ -41,7 +42,7 @@ void WorkerAgent::initialize(JS::Realm& realm)
m_worker_ipc = make_ref_counted<WebWorkerClient>(move(worker_socket));
m_worker_ipc->set_fd_passing_socket(move(fd_passing_socket));
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_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());
}
void WorkerAgent::visit_edges(Cell::Visitor& visitor)
@ -49,6 +50,7 @@ void WorkerAgent::visit_edges(Cell::Visitor& visitor)
Base::visit_edges(visitor);
visitor.visit(m_message_port);
visitor.visit(m_outside_port);
visitor.visit(m_outside_settings);
}
}