LibWeb/HTML: Update worker construction spec steps

This is largely editorial. One behaviour change is that events are now
sent from a global task on the DOMManipulation task source.

Somewhat awkwardly, the spec refers to `this` before the Worker exists.
As it's for getting the relevant global object / settings object, I've
had to work around that.

Corresponds to:
917c2f6a73
This commit is contained in:
Sam Atkins 2025-11-27 11:37:53 +00:00 committed by Andreas Kling
parent edac716e91
commit 62d7011f45
Notes: github-actions[bot] 2025-12-01 14:03:44 +00:00
6 changed files with 129 additions and 103 deletions

View file

@ -27,7 +27,12 @@ public:
virtual ~SharedWorker();
GC::Ref<MessagePort> port() { return m_port; }
// https://html.spec.whatwg.org/multipage/workers.html#dom-sharedworker-port
GC::Ref<MessagePort> port()
{
// The port getter steps are to return this's port.
return m_port;
}
void set_agent(WorkerAgentParent& agent) { m_agent = agent; }
@ -42,7 +47,11 @@ private:
URL::URL m_script_url;
WorkerOptions m_options;
// Each SharedWorker has a port, a MessagePort set when the object is created.
// https://html.spec.whatwg.org/multipage/workers.html#concept-sharedworker-port
GC::Ref<MessagePort> m_port;
GC::Ptr<WorkerAgentParent> m_agent;
};