mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-28 02:27:19 +02:00
Previously, the active document's lifecycle was bound to SessionHistoryEntry via DocumentState. The ownership chain was: Navigable → SessionHistoryEntry → DocumentState → Document This made it impossible to move SessionHistoryEntry to the UI process (which cannot own DOM::Document). This commit decouples the two by giving Navigable a direct m_active_document field that serves as the authoritative source for active_document(). - Navigable owns m_active_document directly; active_document() reads from it instead of going through the active session history entry. - DocumentState no longer holds a Document pointer. Instead, it stores a document_id for "same document?" checks. Same-document navigations share a DocumentState and thus the same document_id, while cross-document navigations create a new DocumentState with a new ID. - A pending_document parameter is threaded through finalize_a_cross_document_navigation → apply_the_push_or_replace → apply_the_history_step so the newly created document reaches activation without being stored on DocumentState. - For traversal, the population output delivers the document. A resolved_document is computed per continuation from either the pending document, the population output, or the current active document (for same-document traversals).
6.4 KiB
6.4 KiB