2022-12-12 10:58:30 +01:00
|
|
|
/*
|
2024-10-04 13:19:50 +02:00
|
|
|
* Copyright (c) 2022, Andreas Kling <andreas@ladybird.org>
|
2022-12-12 10:58:30 +01:00
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
|
*/
|
|
|
|
|
|
2026-04-03 12:53:39 +02:00
|
|
|
#include <LibJS/Runtime/VM.h>
|
2023-08-23 10:26:47 -06:00
|
|
|
#include <LibWeb/Crypto/Crypto.h>
|
2023-04-14 22:27:52 +03:00
|
|
|
#include <LibWeb/HTML/DocumentState.h>
|
2022-12-12 10:58:30 +01:00
|
|
|
#include <LibWeb/HTML/SessionHistoryEntry.h>
|
2025-07-17 13:40:50 -04:00
|
|
|
#include <LibWeb/HTML/StructuredSerialize.h>
|
2022-12-12 10:58:30 +01:00
|
|
|
|
|
|
|
|
namespace Web::HTML {
|
|
|
|
|
|
2026-04-03 12:53:39 +02:00
|
|
|
NonnullRefPtr<SessionHistoryEntry> SessionHistoryEntry::create()
|
2022-12-12 10:58:30 +01:00
|
|
|
{
|
2026-04-03 12:53:39 +02:00
|
|
|
return adopt_ref(*new SessionHistoryEntry());
|
2022-12-12 10:58:30 +01:00
|
|
|
}
|
|
|
|
|
|
2026-04-03 12:53:39 +02:00
|
|
|
SessionHistoryEntry::~SessionHistoryEntry() = default;
|
|
|
|
|
|
|
|
|
|
RefPtr<DocumentState> SessionHistoryEntry::document_state() const { return m_document_state; }
|
|
|
|
|
void SessionHistoryEntry::set_document_state(RefPtr<DocumentState> document_state) { m_document_state = move(document_state); }
|
|
|
|
|
|
2023-08-23 10:26:47 -06:00
|
|
|
SessionHistoryEntry::SessionHistoryEntry()
|
2026-04-03 12:53:39 +02:00
|
|
|
: m_classic_history_api_state(MUST(structured_serialize_for_storage(JS::VM::the(), JS::js_null())))
|
|
|
|
|
, m_navigation_api_state(MUST(structured_serialize_for_storage(JS::VM::the(), JS::js_undefined())))
|
2026-03-24 08:33:21 -04:00
|
|
|
, m_navigation_api_key(Crypto::generate_random_uuid())
|
|
|
|
|
, m_navigation_api_id(Crypto::generate_random_uuid())
|
2023-08-23 10:26:47 -06:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2022-12-12 10:58:30 +01:00
|
|
|
}
|