LibWeb: Remove the workaround "Worker Window" from Workers

We can now properly add the prototypes and constructors to the global
object of the Worker's inner realm, so we don't need this window for
anything anymore.
This commit is contained in:
Andrew Kaster 2022-10-08 17:32:03 -06:00 committed by Andreas Kling
parent a74251ca91
commit 14e1513077
Notes: sideshowbarker 2024-07-17 06:09:33 +09:00
3 changed files with 4 additions and 7 deletions

View File

@ -7,6 +7,7 @@
#pragma once
#include <AK/URL.h>
#include <LibWeb/Bindings/DedicatedWorkerExposedInterfaces.h>
#include <LibWeb/DOM/Document.h>
#include <LibWeb/Forward.h>
@ -33,6 +34,9 @@ public:
auto host_defined = make<Bindings::HostDefined>(*settings_object, *intrinsics);
realm->set_host_defined(move(host_defined));
// FIXME: Shared workers should use the shared worker method
Bindings::add_dedicated_worker_exposed_interfaces(realm->global_object(), *realm);
return *settings_object;
}

View File

@ -128,10 +128,6 @@ void Worker::run_a_worker(AK::URL& url, EnvironmentSettingsObject& outside_setti
auto& console_object = *realm_execution_context->realm->intrinsics().console_object();
m_worker_realm = realm_execution_context->realm;
// FIXME: Remove this once we don't need a hack Window (for prototypes and constructors) in workers anymore.
m_worker_window = HTML::Window::create(*m_worker_realm);
m_worker_realm->set_global_object(m_worker_scope, nullptr);
m_console = adopt_ref(*new WorkerDebugConsoleClient(console_object.console()));
console_object.console().set_client(*m_console);

View File

@ -89,9 +89,6 @@ private:
// 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);
};