LibWeb: Avoid dynamic_cast in EventTarget initialization

Let's use a virtual to tell if something uses the
WindowOrWorkerGlobalScope mixin instead.
This commit is contained in:
Andreas Kling 2025-04-18 10:21:36 +02:00 committed by Andreas Kling
parent 84626c7db2
commit e7b6b84648
Notes: github-actions[bot] 2025-04-18 12:47:57 +00:00
4 changed files with 7 additions and 1 deletions

View file

@ -67,7 +67,7 @@ void EventTarget::initialize(JS::Realm& realm)
// FIXME: We can't do this for HTML::Window or HTML::WorkerGlobalScope, as this will run when creating the initial global object.
// During this time, the ESO is not setup, so it will cause a nullptr dereference in host_defined_intrinsics.
if (!is<HTML::WindowOrWorkerGlobalScopeMixin>(this))
if (!is_window_or_worker_global_scope_mixin())
WEB_SET_PROTOTYPE_FOR_INTERFACE(EventTarget);
}