Skip to content

Truly independent web browser

LibWeb: Activate a history entry's document with set_active_document

Shannon Bootheee293a084a7
diff --git a/Libraries/LibWeb/HTML/LocalNavigable.cpp b/Libraries/LibWeb/HTML/LocalNavigable.cpp
index 5c0a2f944a2..cc9f204fbb9 100644
--- a/Libraries/LibWeb/HTML/LocalNavigable.cpp
+++ b/Libraries/LibWeb/HTML/LocalNavigable.cpp
@@ -1160,28 +1160,11 @@ void LocalNavigable::activate_history_entry(NonnullRefPtr<SessionHistoryEntry> e
// navigate away from it.
VERIFY(!new_document->is_initial_about_blank());
- // DocumentState identifies its associated Document by a process-local ID. Restore that association at the
- // transition that makes a reconstructed entry's Document active.
- auto document_state = entry->document_state();
- VERIFY(document_state);
- document_state->set_document_id(new_document->unique_id());
-
// 4. Set navigable's active session history entry to entry.
+ // NB: Which also makes newDocument the active document, and records it as entry's document state's document, which
+ // a reconstructed entry only knows by ID.
m_active_session_history_entry = entry;
- if (m_active_document && m_active_document != new_document) {
- // The outgoing document's frame in flight reaches the compositor before any of the new one's.
- (void)presenter();
- // The pending post-scroll hover refresh and scrollend settlement belong to the outgoing document; drop them.
- // And so does the hover the page reported to its client; end it.
- cancel_hover_update_after_async_scroll();
- cancel_user_scroll_settlement();
- m_event_handler.reset_hover_for_document_replacement({});
- m_active_document->set_navigable(nullptr);
- }
- m_active_document = new_document;
- DOM::Document::invalidate_full_activity();
- new_document->set_navigable(this);
- set_needs_to_record_display_list();
+ set_active_document(new_document);
// 5. Make active newDocument.
new_document->make_active();