mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-05 06:32:30 +02: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:
committed by
Andrew Kaster
parent
978a3b7321
commit
4d039fc3d4
Notes:
github-actions[bot]
2025-05-18 23:51:04 +00:00
Author: https://github.com/ADKaster Commit: https://github.com/LadybirdBrowser/ladybird/commit/4d039fc3d4b Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4806 Reviewed-by: https://github.com/shannonbooth Reviewed-by: https://github.com/trflynn89
@@ -93,7 +93,7 @@ WebIDL::ExceptionOr<GC::Ref<Worker>> Worker::create(String const& script_url, Wo
|
||||
void run_a_worker(Variant<GC::Ref<Worker>, GC::Ref<SharedWorker>> worker, URL::URL& url, EnvironmentSettingsObject& outside_settings, GC::Ptr<MessagePort> port, WorkerOptions const& options)
|
||||
{
|
||||
// 1. Let is shared be true if worker is a SharedWorker object, and false otherwise.
|
||||
// FIXME: SharedWorker support
|
||||
Bindings::AgentType agent_type = worker.has<GC::Ref<SharedWorker>>() ? Bindings::AgentType::SharedWorker : Bindings::AgentType::DedicatedWorker;
|
||||
|
||||
// 2. Let owner be the relevant owner to add given outside settings.
|
||||
// FIXME: Support WorkerGlobalScope options
|
||||
@@ -111,7 +111,7 @@ void run_a_worker(Variant<GC::Ref<Worker>, GC::Ref<SharedWorker>> worker, URL::U
|
||||
// and is shared. Run the rest of these steps in that agent.
|
||||
|
||||
// Note: This spawns a new process to act as the 'agent' for the worker.
|
||||
auto agent = outside_settings.realm().create<WorkerAgentParent>(url, options, port, outside_settings);
|
||||
auto agent = outside_settings.realm().create<WorkerAgentParent>(url, options, port, outside_settings, agent_type);
|
||||
worker.visit([&](auto worker) { worker->set_agent(agent); });
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user