2022-08-08 17:29:40 -03:00
|
|
|
/*
|
2024-10-04 08:19:50 -03:00
|
|
|
* Copyright (c) 2022, Andreas Kling <andreas@ladybird.org>
|
2022-08-08 17:29:40 -03:00
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
|
*/
|
|
|
|
|
|
2024-04-26 21:09:58 -03:00
|
|
|
#include <LibWeb/Bindings/ErrorEventPrototype.h>
|
2022-09-25 19:38:21 -03:00
|
|
|
#include <LibWeb/Bindings/Intrinsics.h>
|
2022-08-08 17:29:40 -03:00
|
|
|
#include <LibWeb/HTML/ErrorEvent.h>
|
|
|
|
|
|
|
|
|
|
namespace Web::HTML {
|
|
|
|
|
|
2024-11-14 12:01:23 -03:00
|
|
|
GC_DEFINE_ALLOCATOR(ErrorEvent);
|
2023-11-19 15:47:52 -03:00
|
|
|
|
2024-11-14 12:01:23 -03:00
|
|
|
GC::Ref<ErrorEvent> ErrorEvent::create(JS::Realm& realm, FlyString const& event_name, ErrorEventInit const& event_init)
|
2022-08-08 17:29:40 -03:00
|
|
|
{
|
2024-12-14 21:06:11 -03:00
|
|
|
auto event = realm.create<ErrorEvent>(realm, event_name, event_init);
|
|
|
|
|
event->set_is_trusted(true);
|
|
|
|
|
return event;
|
2022-08-08 17:29:40 -03:00
|
|
|
}
|
|
|
|
|
|
2024-11-14 12:01:23 -03:00
|
|
|
WebIDL::ExceptionOr<GC::Ref<ErrorEvent>> ErrorEvent::construct_impl(JS::Realm& realm, FlyString const& event_name, ErrorEventInit const& event_init)
|
2022-08-08 17:29:40 -03:00
|
|
|
{
|
2024-12-14 21:06:11 -03:00
|
|
|
return realm.create<ErrorEvent>(realm, event_name, event_init);
|
2022-08-08 17:29:40 -03:00
|
|
|
}
|
|
|
|
|
|
2023-03-05 06:17:53 -03:00
|
|
|
ErrorEvent::ErrorEvent(JS::Realm& realm, FlyString const& event_name, ErrorEventInit const& event_init)
|
2025-03-24 16:52:41 -03:00
|
|
|
: DOM::Event(realm, event_name, event_init)
|
2022-08-08 17:29:40 -03:00
|
|
|
, m_message(event_init.message)
|
|
|
|
|
, m_filename(event_init.filename)
|
|
|
|
|
, m_lineno(event_init.lineno)
|
|
|
|
|
, m_colno(event_init.colno)
|
|
|
|
|
, m_error(event_init.error)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ErrorEvent::~ErrorEvent() = default;
|
|
|
|
|
|
2023-08-07 03:41:28 -03:00
|
|
|
void ErrorEvent::initialize(JS::Realm& realm)
|
2023-01-10 08:28:20 -03:00
|
|
|
{
|
2023-08-07 03:41:28 -03:00
|
|
|
Base::initialize(realm);
|
2024-03-16 09:13:08 -03:00
|
|
|
WEB_SET_PROTOTYPE_FOR_INTERFACE(ErrorEvent);
|
2023-01-10 08:28:20 -03:00
|
|
|
}
|
|
|
|
|
|
2022-08-08 17:29:40 -03:00
|
|
|
void ErrorEvent::visit_edges(Cell::Visitor& visitor)
|
|
|
|
|
{
|
|
|
|
|
Base::visit_edges(visitor);
|
|
|
|
|
visitor.visit(m_error);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|