LibWeb: Bring HistoryHandlingBehavior up to date with the specification

Co-Authored-By: Andrew Kaster <akaster@serenityos.org>
This commit is contained in:
Aliaksandr Kalenik 2024-03-28 12:58:43 +01:00 committed by Andreas Kling
parent b6cf62d00a
commit 39f74d3437
Notes: sideshowbarker 2024-07-17 08:59:18 +09:00
8 changed files with 24 additions and 24 deletions

View file

@ -186,6 +186,7 @@ bool Navigation::can_go_forward() const
return (m_current_entry_index != static_cast<i64>(m_entry_list.size()));
}
// https://html.spec.whatwg.org/multipage/browsing-the-web.html#history-handling-behavior
HistoryHandlingBehavior to_history_handling_behavior(Bindings::NavigationHistoryBehavior b)
{
// A history handling behavior is a NavigationHistoryBehavior that is either "push" or "replace",
@ -203,6 +204,21 @@ HistoryHandlingBehavior to_history_handling_behavior(Bindings::NavigationHistory
VERIFY_NOT_REACHED();
}
// https://html.spec.whatwg.org/multipage/browsing-the-web.html#history-handling-behavior
Bindings::NavigationHistoryBehavior to_navigation_history_behavior(HistoryHandlingBehavior b)
{
// A history handling behavior is a NavigationHistoryBehavior that is either "push" or "replace",
// i.e., that has been resolved away from any initial "auto" value.
switch (b) {
case HistoryHandlingBehavior::Push:
return Bindings::NavigationHistoryBehavior::Push;
case HistoryHandlingBehavior::Replace:
return Bindings::NavigationHistoryBehavior::Replace;
}
VERIFY_NOT_REACHED();
}
// https://html.spec.whatwg.org/multipage/nav-history-apis.html#dom-navigation-navigate
WebIDL::ExceptionOr<NavigationResult> Navigation::navigate(String url, NavigationNavigateOptions const& options)
{