mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-25 00:50:22 +00:00
LibWeb: Match spec changes to "apply the history step"
Corresponds to https://github.com/whatwg/html/pull/10704
This commit is contained in:
parent
0a578ee345
commit
c5c5d97544
Notes:
github-actions[bot]
2024-11-09 14:28:39 +00:00
Author: https://github.com/AtkinsSJ Commit: https://github.com/LadybirdBrowser/ladybird/commit/c5c5d97544c Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2080 Reviewed-by: https://github.com/ADKaster Reviewed-by: https://github.com/awesomekling Reviewed-by: https://github.com/shannonbooth
3 changed files with 12 additions and 7 deletions
|
@ -4386,7 +4386,7 @@ void Document::restore_the_history_object_state(JS::NonnullGCPtr<HTML::SessionHi
|
|||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/browsing-the-web.html#update-document-for-history-step-application
|
||||
void Document::update_for_history_step_application(JS::NonnullGCPtr<HTML::SessionHistoryEntry> entry, bool do_not_reactivate, size_t script_history_length, size_t script_history_index, Optional<Bindings::NavigationType> navigation_type, Optional<Vector<JS::NonnullGCPtr<HTML::SessionHistoryEntry>>> entries_for_navigation_api, Optional<JS::NonnullGCPtr<HTML::SessionHistoryEntry>> previous_entry_for_activation, bool update_navigation_api)
|
||||
void Document::update_for_history_step_application(JS::NonnullGCPtr<HTML::SessionHistoryEntry> entry, bool do_not_reactivate, size_t script_history_length, size_t script_history_index, Optional<Bindings::NavigationType> navigation_type, Optional<Vector<JS::NonnullGCPtr<HTML::SessionHistoryEntry>>> entries_for_navigation_api, JS::GCPtr<HTML::SessionHistoryEntry> previous_entry_for_activation, bool update_navigation_api)
|
||||
{
|
||||
(void)previous_entry_for_activation;
|
||||
|
||||
|
|
|
@ -614,7 +614,7 @@ public:
|
|||
|
||||
HTML::SourceSnapshotParams snapshot_source_snapshot_params() const;
|
||||
|
||||
void update_for_history_step_application(JS::NonnullGCPtr<HTML::SessionHistoryEntry>, bool do_not_reactivate, size_t script_history_length, size_t script_history_index, Optional<Bindings::NavigationType> navigation_type, Optional<Vector<JS::NonnullGCPtr<HTML::SessionHistoryEntry>>> entries_for_navigation_api = {}, Optional<JS::NonnullGCPtr<HTML::SessionHistoryEntry>> previous_entry_for_activation = {}, bool update_navigation_api = true);
|
||||
void update_for_history_step_application(JS::NonnullGCPtr<HTML::SessionHistoryEntry>, bool do_not_reactivate, size_t script_history_length, size_t script_history_index, Optional<Bindings::NavigationType> navigation_type, Optional<Vector<JS::NonnullGCPtr<HTML::SessionHistoryEntry>>> entries_for_navigation_api = {}, JS::GCPtr<HTML::SessionHistoryEntry> previous_entry_for_activation = {}, bool update_navigation_api = true);
|
||||
|
||||
HashMap<URL::URL, JS::GCPtr<HTML::SharedResourceRequest>>& shared_resource_requests();
|
||||
|
||||
|
|
|
@ -735,6 +735,8 @@ TraversableNavigable::HistoryStepResult TraversableNavigable::apply_the_history_
|
|||
// 9. Let entriesForNavigationAPI be the result of getting session history entries for the navigation API given navigable and targetStep.
|
||||
auto entries_for_navigation_api = get_session_history_entries_for_the_navigation_api(*navigable, target_step);
|
||||
|
||||
// NOTE: Steps 10 and 11 come after step 12.
|
||||
|
||||
// 12. In both cases, let afterPotentialUnloads be the following steps:
|
||||
bool const update_only = changing_navigable_continuation->update_only;
|
||||
JS::GCPtr<SessionHistoryEntry> const target_entry = changing_navigable_continuation->target_entry;
|
||||
|
@ -746,15 +748,18 @@ TraversableNavigable::HistoryStepResult TraversableNavigable::apply_the_history_
|
|||
target_entry->set_classic_history_api_state(populated_target_entry->classic_history_api_state());
|
||||
}
|
||||
|
||||
// 1. If changingNavigableContinuation's update-only is false, then activate history entry targetEntry for navigable.
|
||||
// 1. Let previousEntry be navigable's active session history entry.
|
||||
JS::GCPtr<SessionHistoryEntry> const previous_entry = navigable->active_session_history_entry();
|
||||
|
||||
// 2. If changingNavigableContinuation's update-only is false, then activate history entry targetEntry for navigable.
|
||||
if (!update_only)
|
||||
navigable->activate_history_entry(*target_entry);
|
||||
|
||||
// 2. Let updateDocument be an algorithm step which performs update document for history step application given
|
||||
// 3. Let updateDocument be an algorithm step which performs update document for history step application given
|
||||
// targetEntry's document, targetEntry, changingNavigableContinuation's update-only, scriptHistoryLength,
|
||||
// scriptHistoryIndex, navigationType, entriesForNavigationAPI, and displayedEntry.
|
||||
auto update_document = [script_history_length, script_history_index, entries_for_navigation_api = move(entries_for_navigation_api), target_entry, update_only, navigation_type] {
|
||||
target_entry->document()->update_for_history_step_application(*target_entry, update_only, script_history_length, script_history_index, navigation_type, entries_for_navigation_api);
|
||||
// scriptHistoryIndex, navigationType, entriesForNavigationAPI, and previousEntry.
|
||||
auto update_document = [script_history_length, script_history_index, entries_for_navigation_api = move(entries_for_navigation_api), target_entry, update_only, navigation_type, previous_entry] {
|
||||
target_entry->document()->update_for_history_step_application(*target_entry, update_only, script_history_length, script_history_index, navigation_type, entries_for_navigation_api, previous_entry);
|
||||
};
|
||||
|
||||
// 3. If targetEntry's document is equal to displayedDocument, then perform updateDocument.
|
||||
|
|
Loading…
Reference in a new issue