|
@@ -42,6 +42,25 @@ EventTarget::EventTarget(JS::Realm& realm)
|
|
|
|
|
|
EventTarget::~EventTarget() = default;
|
|
|
|
|
|
+// https://dom.spec.whatwg.org/#dom-eventtarget-eventtarget
|
|
|
+WebIDL::ExceptionOr<JS::NonnullGCPtr<EventTarget>> EventTarget::construct_impl(JS::Realm& realm)
|
|
|
+{
|
|
|
+ // The new EventTarget() constructor steps are to do nothing.
|
|
|
+ return MUST_OR_THROW_OOM(realm.heap().allocate<EventTarget>(realm, realm));
|
|
|
+}
|
|
|
+
|
|
|
+JS::ThrowCompletionOr<void> EventTarget::initialize(JS::Realm& realm)
|
|
|
+{
|
|
|
+ MUST_OR_THROW_OOM(Base::initialize(realm));
|
|
|
+
|
|
|
+ // FIXME: We can't do this for HTML::Window currently, 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))
|
|
|
+ set_prototype(&Bindings::ensure_web_prototype<Bindings::EventTargetPrototype>(realm, "EventTarget"));
|
|
|
+
|
|
|
+ return {};
|
|
|
+}
|
|
|
+
|
|
|
void EventTarget::visit_edges(Cell::Visitor& visitor)
|
|
|
{
|
|
|
Base::visit_edges(visitor);
|