mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-24 13:35:12 +00:00
LibWeb: Implement reload for navigables
This commit is contained in:
parent
21f39061fd
commit
ffd5b3da16
Notes:
sideshowbarker
2024-07-16 18:26:46 +09:00
Author: https://github.com/kalenikaliaksandr Commit: https://github.com/SerenityOS/serenity/commit/ffd5b3da16 Pull-request: https://github.com/SerenityOS/serenity/pull/19508
4 changed files with 28 additions and 0 deletions
|
@ -951,4 +951,19 @@ WebIDL::ExceptionOr<void> Navigable::navigate_to_a_javascript_url(AK::URL const&
|
|||
TODO();
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/browsing-the-web.html#reload
|
||||
void Navigable::reload()
|
||||
{
|
||||
// 1. Set navigable's active session history entry's document state's reload pending to true.
|
||||
active_session_history_entry()->document_state->set_reload_pending(true);
|
||||
|
||||
// 2. Let traversable be navigable's traversable navigable.
|
||||
auto traversable = traversable_navigable();
|
||||
|
||||
// FIXME: 3. Append the following session history traversal steps to traversable:
|
||||
|
||||
// 1. Apply pending history changes to traversable with true.
|
||||
traversable->apply_pending_history_changes();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -87,6 +87,8 @@ public:
|
|||
|
||||
WebIDL::ExceptionOr<void> navigate_to_a_javascript_url(AK::URL const&, HistoryHandlingBehavior, Origin const& initiator_origin, CSPNavigationType csp_navigation_type);
|
||||
|
||||
void reload();
|
||||
|
||||
protected:
|
||||
Navigable();
|
||||
|
||||
|
|
|
@ -498,4 +498,14 @@ void TraversableNavigable::traverse_the_history_by_delta(int delta)
|
|||
apply_the_history_step(all_steps[target_step_index]);
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/browsing-the-web.html#apply-pending-history-changes
|
||||
void TraversableNavigable::apply_pending_history_changes()
|
||||
{
|
||||
// 1. Let targetStep be traversable's current session history step.
|
||||
auto target_step = current_session_history_step();
|
||||
|
||||
// 2. Apply the history step targetStep to traversable with checkForUserCancelation set to checkForUserCancelation.
|
||||
apply_the_history_step(target_step);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -37,6 +37,7 @@ public:
|
|||
HistoryObjectLengthAndIndex get_the_history_object_length_and_index(int) const;
|
||||
|
||||
void apply_the_history_step(int step, Optional<SourceSnapshotParams> = {});
|
||||
void apply_pending_history_changes();
|
||||
|
||||
int get_the_used_step(int step) const;
|
||||
Vector<JS::Handle<Navigable>> get_all_navigables_whose_current_session_history_entry_will_change_or_reload(int) const;
|
||||
|
|
Loading…
Add table
Reference in a new issue