diff --git a/Userland/Libraries/LibWeb/HTML/Navigable.cpp b/Userland/Libraries/LibWeb/HTML/Navigable.cpp
index beec6b90d4..ac44083677 100644
--- a/Userland/Libraries/LibWeb/HTML/Navigable.cpp
+++ b/Userland/Libraries/LibWeb/HTML/Navigable.cpp
@@ -1293,8 +1293,8 @@ void Navigable::reload()
// 3. Append the following session history traversal steps to traversable:
traversable->append_session_history_traversal_steps([traversable] {
- // 1. Apply pending history changes to traversable with true.
- traversable->apply_pending_history_changes();
+ // 1. Apply the reload history step to traversable.
+ traversable->apply_the_reload_history_step();
});
}
@@ -1438,8 +1438,8 @@ void finalize_a_cross_document_navigation(JS::NonnullGCPtr navigable,
target_step = traversable->current_session_history_step();
}
- // FIXME: 10. Apply the push/replace history step targetStep to traversable.
- traversable->apply_the_history_step(target_step);
+ // 10. Apply the push/replace history step targetStep to traversable.
+ traversable->apply_the_push_or_replace_history_step(target_step);
}
// https://html.spec.whatwg.org/multipage/browsing-the-web.html#url-and-history-update-steps
diff --git a/Userland/Libraries/LibWeb/HTML/NavigableContainer.cpp b/Userland/Libraries/LibWeb/HTML/NavigableContainer.cpp
index e60de73591..45e1c4baec 100644
--- a/Userland/Libraries/LibWeb/HTML/NavigableContainer.cpp
+++ b/Userland/Libraries/LibWeb/HTML/NavigableContainer.cpp
@@ -126,7 +126,8 @@ WebIDL::ExceptionOr NavigableContainer::create_new_child_navigable()
// 5. Append nestedHistory to parentDocState's nested histories.
parent_doc_state->nested_histories().append(move(nested_history));
- // FIXME: 6. Update for navigable creation/destruction given traversable
+ // 6. Update for navigable creation/destruction given traversable
+ traversable->update_for_navigable_creation_or_destruction();
});
return {};
@@ -336,7 +337,7 @@ void NavigableContainer::destroy_the_child_navigable()
// 8. Append the following session history traversal steps to traversable:
traversable->append_session_history_traversal_steps([traversable] {
// 1. Apply pending history changes to traversable.
- traversable->apply_pending_history_changes();
+ traversable->update_for_navigable_creation_or_destruction();
});
}
diff --git a/Userland/Libraries/LibWeb/HTML/TraversableNavigable.cpp b/Userland/Libraries/LibWeb/HTML/TraversableNavigable.cpp
index bcb8f73a68..e6ef402a1f 100644
--- a/Userland/Libraries/LibWeb/HTML/TraversableNavigable.cpp
+++ b/Userland/Libraries/LibWeb/HTML/TraversableNavigable.cpp
@@ -498,14 +498,34 @@ void TraversableNavigable::traverse_the_history_by_delta(int delta)
});
}
-// https://html.spec.whatwg.org/multipage/browsing-the-web.html#apply-pending-history-changes
-void TraversableNavigable::apply_pending_history_changes()
+// https://html.spec.whatwg.org/multipage/browsing-the-web.html#update-for-navigable-creation/destruction
+void TraversableNavigable::update_for_navigable_creation_or_destruction()
{
- // 1. Let targetStep be traversable's current session history step.
- auto target_step = current_session_history_step();
+ // 1. Let step be traversable's current session history step.
+ auto step = current_session_history_step();
- // 2. Apply the history step targetStep to traversable with checkForUserCancelation set to checkForUserCancelation.
- apply_the_history_step(target_step);
+ // 2. Return the result of applying the history step step to traversable given false, false, null, null, and null.
+ // FIXME: Pass false, false, null, null, and null as arguments.
+ apply_the_history_step(step);
+}
+
+// https://html.spec.whatwg.org/multipage/browsing-the-web.html#apply-the-reload-history-step
+void TraversableNavigable::apply_the_reload_history_step()
+{
+ // 1. Let step be traversable's current session history step.
+ auto step = current_session_history_step();
+
+ // 2. Return the result of applying the history step step to traversable given true, false, null, null, and null.
+ // FIXME: Pass true, false, null, null, and null as arguments.
+ apply_the_history_step(step);
+}
+
+void TraversableNavigable::apply_the_push_or_replace_history_step(int step)
+{
+ // 1. Return the result of applying the history step step to traversable given false, false, null, null, and null.
+ // FIXME: Pass false, false, null, null, and null as arguments.
+ // FIXME: Return result of history application.
+ apply_the_history_step(step);
}
// https://html.spec.whatwg.org/multipage/document-sequences.html#close-a-top-level-traversable
@@ -595,7 +615,7 @@ void finalize_a_same_document_navigation(JS::NonnullGCPtr
}
// 6. Apply the push/replace history step targetStep to traversable.
- traversable->apply_the_history_step(*target_step);
+ traversable->apply_the_push_or_replace_history_step(*target_step);
}
}
diff --git a/Userland/Libraries/LibWeb/HTML/TraversableNavigable.h b/Userland/Libraries/LibWeb/HTML/TraversableNavigable.h
index d4f82af2a3..8ddf98c11b 100644
--- a/Userland/Libraries/LibWeb/HTML/TraversableNavigable.h
+++ b/Userland/Libraries/LibWeb/HTML/TraversableNavigable.h
@@ -37,8 +37,9 @@ public:
};
HistoryObjectLengthAndIndex get_the_history_object_length_and_index(int) const;
- void apply_the_history_step(int step, Optional = {});
- void apply_pending_history_changes();
+ void apply_the_reload_history_step();
+ void apply_the_push_or_replace_history_step(int step);
+ void update_for_navigable_creation_or_destruction();
int get_the_used_step(int step) const;
Vector> get_all_navigables_whose_current_session_history_entry_will_change_or_reload(int) const;
@@ -62,6 +63,8 @@ private:
virtual void visit_edges(Cell::Visitor&) override;
+ void apply_the_history_step(int step, Optional = {});
+
// https://html.spec.whatwg.org/multipage/document-sequences.html#tn-current-session-history-step
int m_current_session_history_step { 0 };