summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/HTML/Worker.h
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2022-09-05 12:19:41 +0200
committerAndreas Kling <kling@serenityos.org>2022-09-06 00:27:09 +0200
commite97cc671eaff2830fc1481f932378727c4136f55 (patch)
tree8d399cfd4026ec02f681b9323f548829427d1da0 /Userland/Libraries/LibWeb/HTML/Worker.h
parentddc018fb757e59f09adac88fc6f98e2c6425c4af (diff)
downloadserenity-e97cc671eaff2830fc1481f932378727c4136f55.zip
LibWeb: Give web workers a (totally hacky) Window object
This is *not* according to spec, however we currently store prototypes and constructors on Window, so the only way for objects in a worker context to become fully formed is to make a Window. Long-term we should clean this up and remove the worker window object, but for now it allows workers to exist without asserting.
Diffstat (limited to 'Userland/Libraries/LibWeb/HTML/Worker.h')
-rw-r--r--Userland/Libraries/LibWeb/HTML/Worker.h9
1 files changed, 7 insertions, 2 deletions
diff --git a/Userland/Libraries/LibWeb/HTML/Worker.h b/Userland/Libraries/LibWeb/HTML/Worker.h
index 833796d31c..5f7b892841 100644
--- a/Userland/Libraries/LibWeb/HTML/Worker.h
+++ b/Userland/Libraries/LibWeb/HTML/Worker.h
@@ -80,13 +80,18 @@ private:
NonnullOwnPtr<JS::Interpreter> m_interpreter;
WeakPtr<WorkerEnvironmentSettingsObject> m_inner_settings;
JS::VM::InterpreterExecutionScope m_interpreter_scope;
- JS::GCPtr<JS::Realm> m_worker_realm;
RefPtr<WorkerDebugConsoleClient> m_console;
- JS::GCPtr<JS::Object> m_worker_scope;
JS::NonnullGCPtr<MessagePort> m_implicit_port;
JS::GCPtr<MessagePort> m_outside_port;
+ // NOTE: These are inside the worker VM.
+ JS::GCPtr<JS::Realm> m_worker_realm;
+ JS::GCPtr<JS::Object> m_worker_scope;
+ // FIXME: This is a mega-hack but necessary because HTML::Window holds all the prototypes and constructors.
+ // There should be *no* Window object in a Worker context.
+ JS::GCPtr<HTML::Window> m_worker_window;
+
void run_a_worker(AK::URL& url, EnvironmentSettingsObject& outside_settings, MessagePort& outside_port, WorkerOptions const options);
};