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:
Andrew Kaster 2025-05-18 14:10:01 -06:00 committed by Andrew Kaster
commit 4d039fc3d4
Notes: github-actions[bot] 2025-05-18 23:51:04 +00:00
11 changed files with 88 additions and 39 deletions

View file

@ -25,6 +25,15 @@ class SharedWorkerGlobalScope
public:
virtual ~SharedWorkerGlobalScope() override;
void set_constructor_origin(URL::Origin origin) { m_constructor_origin = move(origin); }
URL::Origin const& constructor_origin() const { return m_constructor_origin; }
void set_constructor_url(URL::URL url) { m_constructor_url = move(url); }
URL::URL const& constructor_url() const { return m_constructor_url; }
Fetch::Infrastructure::Request::CredentialsMode credentials() const { return m_credentials; }
void set_credentials(Fetch::Infrastructure::Request::CredentialsMode credentials) { m_credentials = credentials; }
void close();
#define __ENUMERATE(attribute_name, event_name) \
@ -38,6 +47,10 @@ private:
virtual void initialize_web_interfaces_impl() override;
virtual void finalize() override;
URL::Origin m_constructor_origin;
URL::URL m_constructor_url;
Fetch::Infrastructure::Request::CredentialsMode m_credentials;
};
HashTable<GC::RawRef<SharedWorkerGlobalScope>>& all_shared_worker_global_scopes();