Coverage Report

Created: 2025-03-04 07:22

/src/serenity/Userland/Libraries/LibWeb/HTML/PromiseRejectionEvent.cpp
Line
Count
Source (jump to first uncovered line)
1
/*
2
 * Copyright (c) 2022, Andreas Kling <kling@serenityos.org>
3
 *
4
 * SPDX-License-Identifier: BSD-2-Clause
5
 */
6
7
#include <LibWeb/Bindings/Intrinsics.h>
8
#include <LibWeb/Bindings/PromiseRejectionEventPrototype.h>
9
#include <LibWeb/HTML/PromiseRejectionEvent.h>
10
11
namespace Web::HTML {
12
13
JS_DEFINE_ALLOCATOR(PromiseRejectionEvent);
14
15
JS::NonnullGCPtr<PromiseRejectionEvent> PromiseRejectionEvent::create(JS::Realm& realm, FlyString const& event_name, PromiseRejectionEventInit const& event_init)
16
0
{
17
0
    return realm.heap().allocate<PromiseRejectionEvent>(realm, realm, event_name, event_init);
18
0
}
19
20
WebIDL::ExceptionOr<JS::NonnullGCPtr<PromiseRejectionEvent>> PromiseRejectionEvent::construct_impl(JS::Realm& realm, FlyString const& event_name, PromiseRejectionEventInit const& event_init)
21
0
{
22
0
    return create(realm, event_name, event_init);
23
0
}
24
25
PromiseRejectionEvent::PromiseRejectionEvent(JS::Realm& realm, FlyString const& event_name, PromiseRejectionEventInit const& event_init)
26
0
    : DOM::Event(realm, event_name, event_init)
27
0
    , m_promise(const_cast<JS::Promise*>(event_init.promise.cell()))
28
0
    , m_reason(event_init.reason)
29
0
{
30
0
}
31
32
0
PromiseRejectionEvent::~PromiseRejectionEvent() = default;
33
34
void PromiseRejectionEvent::visit_edges(Cell::Visitor& visitor)
35
0
{
36
0
    Base::visit_edges(visitor);
37
0
    visitor.visit(m_promise);
38
0
    visitor.visit(m_reason);
39
0
}
40
41
void PromiseRejectionEvent::initialize(JS::Realm& realm)
42
0
{
43
0
    Base::initialize(realm);
44
0
    WEB_SET_PROTOTYPE_FOR_INTERFACE(PromiseRejectionEvent);
45
0
}
46
47
}