/src/serenity/Userland/Libraries/LibWeb/HTML/NavigationHistoryEntry.h
Line | Count | Source (jump to first uncovered line) |
1 | | /* |
2 | | * Copyright (c) 2023, Andrew Kaster <akaster@serenityos.org> |
3 | | * |
4 | | * SPDX-License-Identifier: BSD-2-Clause |
5 | | */ |
6 | | |
7 | | #pragma once |
8 | | |
9 | | #include <LibWeb/DOM/EventTarget.h> |
10 | | |
11 | | namespace Web::HTML { |
12 | | |
13 | | // https://html.spec.whatwg.org/multipage/nav-history-apis.html#navigationhistoryentry |
14 | | class NavigationHistoryEntry : public DOM::EventTarget { |
15 | | WEB_PLATFORM_OBJECT(NavigationHistoryEntry, DOM::EventTarget); |
16 | | JS_DECLARE_ALLOCATOR(NavigationHistoryEntry); |
17 | | |
18 | | public: |
19 | | [[nodiscard]] static JS::NonnullGCPtr<NavigationHistoryEntry> create(JS::Realm&, JS::NonnullGCPtr<SessionHistoryEntry>); |
20 | | |
21 | | WebIDL::ExceptionOr<Optional<String>> url() const; |
22 | | String key() const; |
23 | | String id() const; |
24 | | i64 index() const; |
25 | | bool same_document() const; |
26 | | WebIDL::ExceptionOr<JS::Value> get_state(); |
27 | | |
28 | | void set_ondispose(WebIDL::CallbackType*); |
29 | | WebIDL::CallbackType* ondispose(); |
30 | | |
31 | | // Non-spec'd getter, not exposed to JS |
32 | 0 | SessionHistoryEntry const& session_history_entry() const { return *m_session_history_entry; } |
33 | 0 | SessionHistoryEntry& session_history_entry() { return *m_session_history_entry; } |
34 | | |
35 | | virtual ~NavigationHistoryEntry() override; |
36 | | |
37 | | private: |
38 | | NavigationHistoryEntry(JS::Realm&, JS::NonnullGCPtr<SessionHistoryEntry>); |
39 | | |
40 | | virtual void initialize(JS::Realm&) override; |
41 | | virtual void visit_edges(JS::Cell::Visitor&) override; |
42 | | |
43 | | JS::NonnullGCPtr<SessionHistoryEntry> m_session_history_entry; |
44 | | }; |
45 | | } |