1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 01:37:35 +00:00

LibWeb: Don't set EventTarget prototype on any WindowOrWorkerGlobalScope

The same limitations regarding construction of Window apply to all
WorkerGlobalScope classes as well.
This commit is contained in:
Andrew Kaster 2023-11-08 11:41:40 -07:00 committed by Andreas Kling
parent 4fcff01ef3
commit 5586340cf3

View file

@ -56,9 +56,9 @@ void EventTarget::initialize(JS::Realm& realm)
{
Base::initialize(realm);
// FIXME: We can't do this for HTML::Window currently, as this will run when creating the initial global object.
// 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::Window>(this))
if (!is<HTML::WindowOrWorkerGlobalScopeMixin>(this))
set_prototype(&Bindings::ensure_web_prototype<Bindings::EventTargetPrototype>(realm, "EventTarget"));
}