mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2026-04-19 10:20:22 +00:00
With apply_to() now self-contained (carrying its own replacement DocumentState rather than reading from the live entry), the clone at the traversal call site is no longer needed. The clone previously served two purposes: 1. Input snapshot: freeze entry fields before deferred population. Now solved by changing populate_session_history_entry_document() to take explicit input parameters, snapshotted before the deferred_invoke. 2. Output isolation: absorb apply_to() and post-population adjustments without mutating the live entry during unload. Now solved by storing the PopulateSessionHistoryEntryDocumentOutput on the continuation state and deferring all mutations (including the origin-based classic_history_api_state reset and navigable_target_name clear) to after_potential_unload. The post-population adjustments run unconditionally in after_potential_unload, covering both the population path and the non-population path (e.g. traversal to an already-populated error entry).
32 lines
850 B
C++
32 lines
850 B
C++
/*
|
|
* Copyright (c) 2022, Andreas Kling <andreas@ladybird.org>
|
|
* Copyright (c) 2023, Aliaksandr Kalenik <kalenik.aliaksandr@gmail.com>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#include <LibWeb/DOM/Document.h>
|
|
#include <LibWeb/HTML/DocumentState.h>
|
|
#include <LibWeb/HTML/SessionHistoryEntry.h>
|
|
|
|
namespace Web::HTML {
|
|
|
|
GC_DEFINE_ALLOCATOR(DocumentState);
|
|
|
|
DocumentState::DocumentState() = default;
|
|
|
|
DocumentState::~DocumentState() = default;
|
|
|
|
void DocumentState::visit_edges(Cell::Visitor& visitor)
|
|
{
|
|
Base::visit_edges(visitor);
|
|
visitor.visit(m_document);
|
|
m_history_policy_container.visit(
|
|
[&](GC::Ref<PolicyContainer> const& policy_container) { visitor.visit(policy_container); },
|
|
[](auto const&) {});
|
|
for (auto& nested_history : m_nested_histories) {
|
|
visitor.visit(nested_history.entries);
|
|
}
|
|
}
|
|
|
|
}
|