mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 15:17:36 +00:00
LibWeb: Add Navigable::set_ongoing_navigation()
This commit is contained in:
parent
aa0d254fa3
commit
09013583f2
3 changed files with 17 additions and 3 deletions
|
@ -260,6 +260,19 @@ JS::GCPtr<TraversableNavigable> Navigable::top_level_traversable()
|
||||||
return verify_cast<TraversableNavigable>(navigable);
|
return verify_cast<TraversableNavigable>(navigable);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://html.spec.whatwg.org/multipage/browsing-the-web.html#set-the-ongoing-navigation
|
||||||
|
void Navigable::set_ongoing_navigation(Variant<Empty, Traversal, String> ongoing_navigation)
|
||||||
|
{
|
||||||
|
// 1. If navigable's ongoing navigation is equal to newValue, then return.
|
||||||
|
if (m_ongoing_navigation == ongoing_navigation)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// FIXME: 2. Inform the navigation API about aborting navigation given navigable.
|
||||||
|
|
||||||
|
// 3. Set navigable's ongoing navigation to newValue.
|
||||||
|
m_ongoing_navigation = ongoing_navigation;
|
||||||
|
}
|
||||||
|
|
||||||
Navigable::ChosenNavigable Navigable::choose_a_navigable(StringView name, TokenizedFeature::NoOpener, ActivateTab)
|
Navigable::ChosenNavigable Navigable::choose_a_navigable(StringView name, TokenizedFeature::NoOpener, ActivateTab)
|
||||||
{
|
{
|
||||||
// 1. Let chosen be null.
|
// 1. Let chosen be null.
|
||||||
|
@ -919,7 +932,7 @@ WebIDL::ExceptionOr<void> Navigable::navigate(
|
||||||
}
|
}
|
||||||
|
|
||||||
// 17. Set navigable's ongoing navigation to navigationId.
|
// 17. Set navigable's ongoing navigation to navigationId.
|
||||||
m_ongoing_navigation = navigation_id;
|
set_ongoing_navigation(navigation_id);
|
||||||
|
|
||||||
// 18. If url's scheme is "javascript", then:
|
// 18. If url's scheme is "javascript", then:
|
||||||
if (url.scheme() == "javascript"sv) {
|
if (url.scheme() == "javascript"sv) {
|
||||||
|
|
|
@ -105,6 +105,7 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
Variant<Empty, Traversal, String> ongoing_navigation() const { return m_ongoing_navigation; }
|
Variant<Empty, Traversal, String> ongoing_navigation() const { return m_ongoing_navigation; }
|
||||||
|
void set_ongoing_navigation(Variant<Empty, Traversal, String> ongoing_navigation);
|
||||||
|
|
||||||
WebIDL::ExceptionOr<void> populate_session_history_entry_document(JS::GCPtr<SessionHistoryEntry>, Optional<NavigationParams>, Optional<String> navigation_id, SourceSnapshotParams const&, bool allow_POST, Function<void()>);
|
WebIDL::ExceptionOr<void> populate_session_history_entry_document(JS::GCPtr<SessionHistoryEntry>, Optional<NavigationParams>, Optional<String> navigation_id, SourceSnapshotParams const&, bool allow_POST, Function<void()>);
|
||||||
|
|
||||||
|
|
|
@ -256,7 +256,7 @@ void TraversableNavigable::apply_the_history_step(int step, Optional<SourceSnaps
|
||||||
navigable->set_current_session_history_entry(target_entry);
|
navigable->set_current_session_history_entry(target_entry);
|
||||||
|
|
||||||
// 3. Set navigable's ongoing navigation to "traversal".
|
// 3. Set navigable's ongoing navigation to "traversal".
|
||||||
m_ongoing_navigation = Traversal::Tag;
|
set_ongoing_navigation(Traversal::Tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 9. Let totalChangeJobs be the size of changingNavigables.
|
// 9. Let totalChangeJobs be the size of changingNavigables.
|
||||||
|
@ -390,7 +390,7 @@ void TraversableNavigable::apply_the_history_step(int step, Optional<SourceSnaps
|
||||||
auto navigable = changing_navigable_continuation.navigable;
|
auto navigable = changing_navigable_continuation.navigable;
|
||||||
|
|
||||||
// 7. Set navigable's ongoing navigation to null.
|
// 7. Set navigable's ongoing navigation to null.
|
||||||
m_ongoing_navigation = {};
|
set_ongoing_navigation({});
|
||||||
|
|
||||||
// 8. Let (scriptHistoryLength, scriptHistoryIndex) be the result of getting the history object length and index given traversable and targetStep.
|
// 8. Let (scriptHistoryLength, scriptHistoryIndex) be the result of getting the history object length and index given traversable and targetStep.
|
||||||
auto [script_history_length, script_history_index] = get_the_history_object_length_and_index(target_step);
|
auto [script_history_length, script_history_index] = get_the_history_object_length_and_index(target_step);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue