Coverage Report

Created: 2025-11-16 07:46

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/serenity/Userland/Libraries/LibWeb/XHR/ProgressEvent.h
Line
Count
Source
1
/*
2
 * Copyright (c) 2021, the SerenityOS developers.
3
 *
4
 * SPDX-License-Identifier: BSD-2-Clause
5
 */
6
7
#pragma once
8
9
#include <AK/FlyString.h>
10
#include <LibWeb/DOM/Event.h>
11
#include <LibWeb/WebIDL/Types.h>
12
13
namespace Web::XHR {
14
15
struct ProgressEventInit : public DOM::EventInit {
16
    bool length_computable { false };
17
    WebIDL::UnsignedLongLong loaded { 0 };
18
    WebIDL::UnsignedLongLong total { 0 };
19
};
20
21
class ProgressEvent final : public DOM::Event {
22
    WEB_PLATFORM_OBJECT(ProgressEvent, DOM::Event);
23
    JS_DECLARE_ALLOCATOR(ProgressEvent);
24
25
public:
26
    [[nodiscard]] static JS::NonnullGCPtr<ProgressEvent> create(JS::Realm&, FlyString const& event_name, ProgressEventInit const& event_init);
27
    static WebIDL::ExceptionOr<JS::NonnullGCPtr<ProgressEvent>> construct_impl(JS::Realm&, FlyString const& event_name, ProgressEventInit const& event_init);
28
29
    virtual ~ProgressEvent() override;
30
31
0
    bool length_computable() const { return m_length_computable; }
32
0
    WebIDL::UnsignedLongLong loaded() const { return m_loaded; }
33
0
    WebIDL::UnsignedLongLong total() const { return m_total; }
34
35
private:
36
    ProgressEvent(JS::Realm&, FlyString const& event_name, ProgressEventInit const& event_init);
37
38
    virtual void initialize(JS::Realm&) override;
39
40
    bool m_length_computable { false };
41
    WebIDL::UnsignedLongLong m_loaded { 0 };
42
    WebIDL::UnsignedLongLong m_total { 0 };
43
};
44
45
}