diff --git a/Userland/Libraries/LibWeb/HTML/Navigable.cpp b/Userland/Libraries/LibWeb/HTML/Navigable.cpp
index 5cb11fd16d8..e29aeaa842e 100644
--- a/Userland/Libraries/LibWeb/HTML/Navigable.cpp
+++ b/Userland/Libraries/LibWeb/HTML/Navigable.cpp
@@ -115,6 +115,33 @@ JS::GCPtr Navigable::get_the_target_history_entry(int targe
return result;
}
+// https://html.spec.whatwg.org/multipage/browsing-the-web.html#activate-history-entry
+void Navigable::activate_history_entry(JS::GCPtr entry)
+{
+ // FIXME: 1. Save persisted state to the navigable's active session history entry.
+
+ // 2. Let newDocument be entry's document.
+ JS::GCPtr new_document = entry->document_state->document().ptr();
+
+ // 3. Assert: newDocument's is initial about:blank is false, i.e., we never traverse
+ // back to the initial about:blank Document because it always gets replaced when we
+ // navigate away from it.
+ VERIFY(!new_document->is_initial_about_blank());
+
+ // 4. Set navigable's active session history entry to entry.
+ m_active_session_history_entry = entry;
+
+ // 5. Make active newDocument.
+ new_document->make_active();
+
+ // Not in the spec:
+ if (is(*this) && parent() == nullptr) {
+ if (auto* page = active_browsing_context()->page()) {
+ page->client().page_did_start_loading(entry->url, false);
+ }
+ }
+}
+
// https://html.spec.whatwg.org/multipage/document-sequences.html#nav-document
JS::GCPtr Navigable::active_document()
{
diff --git a/Userland/Libraries/LibWeb/HTML/Navigable.h b/Userland/Libraries/LibWeb/HTML/Navigable.h
index ea444972969..e0d353827f8 100644
--- a/Userland/Libraries/LibWeb/HTML/Navigable.h
+++ b/Userland/Libraries/LibWeb/HTML/Navigable.h
@@ -46,6 +46,8 @@ public:
Vector>& get_session_history_entries() const;
+ void activate_history_entry(JS::GCPtr);
+
JS::GCPtr active_document();
JS::GCPtr active_browsing_context();
JS::GCPtr active_window_proxy();