Truly independent web browser
LibWeb+LibWebView+WebContent: Give a created child's entry its step
Shannon Boothf9b2a68a00e7
diff --git a/Libraries/LibWeb/HTML/HistoryExecutor.cpp b/Libraries/LibWeb/HTML/HistoryExecutor.cppindex c7e1b2b8e43..e458230522f 100644--- a/Libraries/LibWeb/HTML/HistoryExecutor.cpp+++ b/Libraries/LibWeb/HTML/HistoryExecutor.cpp@@ -120,7 +120,7 @@ void HistoryExecutor::handle_ui_history_operation_started(CrossProcessId operatiready->function()(Empty {});}-void HistoryExecutor::complete_ui_history_operation(CrossProcessId operation_id, HistoryStepResult result, Optional<i32> committed_step)+void HistoryExecutor::complete_ui_history_operation(CrossProcessId operation_id, HistoryStepResult result, Optional<i32> target_entry_step){auto operation = m_history_operations.take(operation_id);if (!operation.has_value())@@ -132,13 +132,13 @@ void HistoryExecutor::complete_ui_history_operation(CrossProcessId operation_id,navigable->clear_ongoing_history_traversal();}- if (committed_step.has_value()+ if (target_entry_step.has_value()&& operation->local_target_navigable_id.has_value()&& operation->local_target_entry&& !operation->local_target_entry->step_value().has_value()) {if (auto navigable = local_navigable_with_id(*operation->local_target_navigable_id);navigable && !navigable->is_top_level_traversable()) {- operation->local_target_entry->set_step(*committed_step);+ operation->local_target_entry->set_step(*target_entry_step);}}if (operation->on_apply_complete)diff --git a/Libraries/LibWeb/HTML/HistoryExecutor.h b/Libraries/LibWeb/HTML/HistoryExecutor.hindex 5eede8871a1..592b4e007f0 100644--- a/Libraries/LibWeb/HTML/HistoryExecutor.h+++ b/Libraries/LibWeb/HTML/HistoryExecutor.h@@ -62,7 +62,7 @@ public:void request_history_operation(HistoryOperationParameters);void request_history_operation(HistoryOperationParameters, HistoryOperationState);void handle_ui_history_operation_started(CrossProcessId operation_id, GC::Ref<OnHistoryOperationReady>);- void complete_ui_history_operation(CrossProcessId operation_id, HistoryStepResult, Optional<i32> committed_step);+ void complete_ui_history_operation(CrossProcessId operation_id, HistoryStepResult, Optional<i32> target_entry_step);void traverse_the_history_by_delta(int delta, GC::Ptr<DOM::Document> source_document = {});void finalize_same_document_navigation(GC::Ref<LocalNavigable>, NonnullRefPtr<SessionHistoryEntry>, RefPtr<SessionHistoryEntry> entry_to_replace, HistoryHandlingBehavior, UserNavigationInvolvement, Optional<SessionHistoryEntryPersistedState> previous_entry_persisted_state);diff --git a/Libraries/LibWebView/CanonicalTraversable.cpp b/Libraries/LibWebView/CanonicalTraversable.cppindex aa718fcedd2..c362a444705 100644--- a/Libraries/LibWebView/CanonicalTraversable.cpp+++ b/Libraries/LibWebView/CanonicalTraversable.cpp@@ -2819,8 +2819,16 @@ void CanonicalTraversable::report_history_operation_result(HistoryOperation& ope}}+ // The step of the entry the requesting page's operation targets: the committed step, but for a created child's+ // initial entry, whose step the steps creating it set.+ auto target_entry_step = committed_step;+ if (auto const* parameters = operation.parameters.get_pointer<Web::NavigableCreationHistoryOperationParameters>(); parameters && committed_step.has_value()) {+ if (auto child_navigable = find(parameters->navigable_id); child_navigable.has_value())+ target_entry_step = child_navigable->active_session_history_entry()->step;+ }+for (auto& endpoint : operation.completion_endpoints)- endpoint->async_complete_history_operation(operation.operation_id, result, committed_step, m_session_history.size());+ endpoint->async_complete_history_operation(operation.operation_id, result, target_entry_step, m_session_history.size());// All apply-driven mutations have settled at operation completion.session_history_changed();diff --git a/Services/WebContent/ConnectionFromClient.cpp b/Services/WebContent/ConnectionFromClient.cppindex 9dfab3d32c3..efabb5c43f0 100644--- a/Services/WebContent/ConnectionFromClient.cpp+++ b/Services/WebContent/ConnectionFromClient.cpp@@ -814,7 +814,7 @@ void ConnectionFromClient::update_nonchanging_navigable_history_state(Web::PageI}));}-void ConnectionFromClient::complete_history_operation(Web::PageId page_id, Web::HTML::CrossProcessId operation_id, Web::HTML::HistoryStepResult result, Optional<i32> committed_step, u64 session_history_entry_count)+void ConnectionFromClient::complete_history_operation(Web::PageId page_id, Web::HTML::CrossProcessId operation_id, Web::HTML::HistoryStepResult result, Optional<i32> target_entry_step, u64 session_history_entry_count){auto page = this->page(page_id);if (!page.has_value())@@ -822,7 +822,7 @@ void ConnectionFromClient::complete_history_operation(Web::PageId page_id, Web::if (auto* traversable = as_if<Web::HTML::LocalTraversableNavigable>(*page->page().top_level_traversable()))traversable->set_session_history_entry_count(session_history_entry_count);- page->page().history_executor().complete_ui_history_operation(operation_id, result, committed_step);+ page->page().history_executor().complete_ui_history_operation(operation_id, result, target_entry_step);}void ConnectionFromClient::set_viewport(Web::PageId page_id, Web::DevicePixelSize size, double device_pixel_ratio, Web::ViewportIsFullscreen is_fullscreen)diff --git a/Services/WebContent/ConnectionFromClient.h b/Services/WebContent/ConnectionFromClient.hindex 6990ecea99f..879b75cacbb 100644--- a/Services/WebContent/ConnectionFromClient.h+++ b/Services/WebContent/ConnectionFromClient.h@@ -157,7 +157,7 @@ private:virtual void container_unfullscreen_complete(Web::PageId page_id, Web::HTML::CrossProcessId navigable_id) override;virtual void run_traversable_close_unload_task(Web::PageId page_id, Web::HTML::CrossProcessId operation_id) override;virtual void update_nonchanging_navigable_history_state(Web::PageId page_id, Web::HTML::CrossProcessId operation_id, Web::HTML::CrossProcessId navigable_id, u64 script_history_length, u64 script_history_index) override;- virtual void complete_history_operation(Web::PageId page_id, Web::HTML::CrossProcessId operation_id, Web::HTML::HistoryStepResult result, Optional<i32> committed_step, u64 session_history_entry_count) override;+ virtual void complete_history_operation(Web::PageId page_id, Web::HTML::CrossProcessId operation_id, Web::HTML::HistoryStepResult result, Optional<i32> target_entry_step, u64 session_history_entry_count) override;virtual void set_viewport(Web::PageId page_id, Web::DevicePixelSize, double device_pixel_ratio, Web::ViewportIsFullscreen is_fullscreen) override;virtual void set_viewport_is_fullscreen(Web::PageId page_id, Web::ViewportIsFullscreen is_fullscreen) override;virtual void deny_fullscreen_window(Web::PageId page_id) override;diff --git a/Services/WebContent/WebContentServer.ipc b/Services/WebContent/WebContentServer.ipcindex b9fbbe8a932..b2f7233e1e3 100644--- a/Services/WebContent/WebContentServer.ipc+++ b/Services/WebContent/WebContentServer.ipc@@ -130,7 +130,7 @@ endpoint WebContentServer routed by Web::PageId page_idcontainer_unfullscreen_complete(Web::PageId page_id, Web::HTML::CrossProcessId navigable_id) =|run_traversable_close_unload_task(Web::PageId page_id, Web::HTML::CrossProcessId operation_id) =|update_nonchanging_navigable_history_state(Web::PageId page_id, Web::HTML::CrossProcessId operation_id, Web::HTML::CrossProcessId navigable_id, u64 script_history_length, u64 script_history_index) =|- complete_history_operation(Web::PageId page_id, Web::HTML::CrossProcessId operation_id, Web::HTML::HistoryStepResult result, Optional<i32> committed_step, u64 session_history_entry_count) =|+ complete_history_operation(Web::PageId page_id, Web::HTML::CrossProcessId operation_id, Web::HTML::HistoryStepResult result, Optional<i32> target_entry_step, u64 session_history_entry_count) =|set_viewport(Web::PageId page_id, Web::DevicePixelSize size, double device_pixel_ratio, Web::ViewportIsFullscreen is_fullscreen) =|set_viewport_is_fullscreen(Web::PageId page_id, Web::ViewportIsFullscreen is_fullscreen) =|