/src/serenity/Userland/Libraries/LibWeb/HTML/ErrorEvent.cpp
Line | Count | Source |
1 | | /* |
2 | | * Copyright (c) 2022, Andreas Kling <kling@serenityos.org> |
3 | | * |
4 | | * SPDX-License-Identifier: BSD-2-Clause |
5 | | */ |
6 | | |
7 | | #include <LibWeb/Bindings/ErrorEventPrototype.h> |
8 | | #include <LibWeb/Bindings/Intrinsics.h> |
9 | | #include <LibWeb/HTML/ErrorEvent.h> |
10 | | |
11 | | namespace Web::HTML { |
12 | | |
13 | | JS_DEFINE_ALLOCATOR(ErrorEvent); |
14 | | |
15 | | JS::NonnullGCPtr<ErrorEvent> ErrorEvent::create(JS::Realm& realm, FlyString const& event_name, ErrorEventInit const& event_init) |
16 | 0 | { |
17 | 0 | return realm.heap().allocate<ErrorEvent>(realm, realm, event_name, event_init); |
18 | 0 | } |
19 | | |
20 | | WebIDL::ExceptionOr<JS::NonnullGCPtr<ErrorEvent>> ErrorEvent::construct_impl(JS::Realm& realm, FlyString const& event_name, ErrorEventInit const& event_init) |
21 | 0 | { |
22 | 0 | return create(realm, event_name, event_init); |
23 | 0 | } |
24 | | |
25 | | ErrorEvent::ErrorEvent(JS::Realm& realm, FlyString const& event_name, ErrorEventInit const& event_init) |
26 | 0 | : DOM::Event(realm, event_name) |
27 | 0 | , m_message(event_init.message) |
28 | 0 | , m_filename(event_init.filename) |
29 | 0 | , m_lineno(event_init.lineno) |
30 | 0 | , m_colno(event_init.colno) |
31 | 0 | , m_error(event_init.error) |
32 | 0 | { |
33 | 0 | } |
34 | | |
35 | 0 | ErrorEvent::~ErrorEvent() = default; |
36 | | |
37 | | void ErrorEvent::initialize(JS::Realm& realm) |
38 | 0 | { |
39 | 0 | Base::initialize(realm); |
40 | 0 | WEB_SET_PROTOTYPE_FOR_INTERFACE(ErrorEvent); |
41 | 0 | } |
42 | | |
43 | | void ErrorEvent::visit_edges(Cell::Visitor& visitor) |
44 | 0 | { |
45 | 0 | Base::visit_edges(visitor); |
46 | 0 | visitor.visit(m_error); |
47 | 0 | } |
48 | | |
49 | | } |