From 18cfbb5cb442496331d7a4398d1e79157dede822 Mon Sep 17 00:00:00 2001 From: Aliaksandr Kalenik Date: Thu, 28 Mar 2024 13:20:48 +0100 Subject: [PATCH] LibWeb: Bring initialize_navigable() up to date with the spec --- Userland/Libraries/LibWeb/HTML/Navigable.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/Userland/Libraries/LibWeb/HTML/Navigable.cpp b/Userland/Libraries/LibWeb/HTML/Navigable.cpp index 6aaa22af964..6c54683756f 100644 --- a/Userland/Libraries/LibWeb/HTML/Navigable.cpp +++ b/Userland/Libraries/LibWeb/HTML/Navigable.cpp @@ -136,22 +136,23 @@ ErrorOr Navigable::initialize_navigable(JS::NonnullGCPtr do static int next_id = 0; m_id = TRY(String::number(next_id++)); - // 1. Let entry be a new session history entry, with - JS::NonnullGCPtr entry = *heap().allocate_without_realm(); + // 1. Assert: documentState's document is non-null. + VERIFY(document_state->document()); + // 2. Let entry be a new session history entry, with + JS::NonnullGCPtr entry = *heap().allocate_without_realm(); // URL: document's URL entry->set_url(document_state->document()->url()); - // document state: documentState entry->set_document_state(document_state); - // 2. Set navigable's current session history entry to entry. + // 3. Set navigable's current session history entry to entry. m_current_session_history_entry = entry; - // 3. Set navigable's active session history entry to entry. + // 4. Set navigable's active session history entry to entry. m_active_session_history_entry = entry; - // 4. Set navigable's parent to parent. + // 5. Set navigable's parent to parent. m_parent = parent; return {};