Truly independent web browser
LibWebView: Read a history operation's committed step from its run
Shannon Boothd76433c93867
diff --git a/Libraries/LibWebView/CanonicalTraversable.cpp b/Libraries/LibWebView/CanonicalTraversable.cppindex 6123bd78d45..61aebee00ab 100644--- a/Libraries/LibWebView/CanonicalTraversable.cpp+++ b/Libraries/LibWebView/CanonicalTraversable.cpp@@ -2224,7 +2224,7 @@ void CanonicalTraversable::apply_history_step(HistoryOperation& operation, i32 s[this, &operation](Web::HTML::HistoryStepResult result) {if (operation.finished)return;- finish_history_operation(operation.operation_id, result, operation.algorithm->committed_step());+ finish_history_operation(operation.operation_id, result);});operation.algorithm->apply_the_history_step();}@@ -2661,7 +2661,7 @@ void CanonicalTraversable::did_not_apply_reload(Web::HTML::CrossProcessId naviga}// The operation's apply the history step returned result.-void CanonicalTraversable::finish_history_operation(Web::HTML::CrossProcessId operation_id, Web::HTML::HistoryStepResult result, Optional<i32> committed_step)+void CanonicalTraversable::finish_history_operation(Web::HTML::CrossProcessId operation_id, Web::HTML::HistoryStepResult result){auto operation = take_history_operation(operation_id);if (!operation)@@ -2672,7 +2672,7 @@ void CanonicalTraversable::finish_history_operation(Web::HTML::CrossProcessId opoperation->requesting_page->async_history_step_applied(operation_id, result);if (auto const* reload = operation->parameters.get_pointer<Web::ReloadHistoryOperationParameters>(); reload && result != Web::HTML::HistoryStepResult::Applied)did_not_apply_reload(reload->navigable_id);- report_history_operation_completion(*operation, committed_step);+ report_history_operation_completion(*operation);settle_history_operation(operation.release_nonnull());}@@ -2683,7 +2683,7 @@ void CanonicalTraversable::end_history_operation(Web::HTML::CrossProcessId operaif (!operation)return;- report_history_operation_completion(*operation, {});+ report_history_operation_completion(*operation);settle_history_operation(operation.release_nonnull());}@@ -2714,8 +2714,9 @@ OwnPtr<CanonicalTraversable::HistoryOperation> CanonicalTraversable::take_historreturn operation.release_value();}-void CanonicalTraversable::report_history_operation_completion(HistoryOperation& operation, Optional<i32> committed_step)+void CanonicalTraversable::report_history_operation_completion(HistoryOperation& operation){+ auto committed_step = operation.algorithm ? operation.algorithm->committed_step() : Optional<i32> {};if (committed_step.has_value()) {if (auto view = this->view(); view.has_value())view->did_commit_history_step();diff --git a/Libraries/LibWebView/CanonicalTraversable.h b/Libraries/LibWebView/CanonicalTraversable.hindex 36ce3944860..5f07a5112e3 100644--- a/Libraries/LibWebView/CanonicalTraversable.h+++ b/Libraries/LibWebView/CanonicalTraversable.h@@ -224,11 +224,11 @@ private:void apply_the_traverse_history_step(HistoryOperation&, i32 step, Optional<Web::HTML::NavigationSourceSnapshot>, Optional<Web::HTML::CrossProcessId> initiator_to_check, Web::HTML::UserNavigationInvolvement);void resume_applying_the_traverse_history_step(HistoryOperation&, i32 step, Web::HTML::UserNavigationInvolvement);void update_for_navigable_creation_or_destruction(HistoryOperation&);- void finish_history_operation(Web::HTML::CrossProcessId operation_id, Web::HTML::HistoryStepResult, Optional<i32> committed_step);+ void finish_history_operation(Web::HTML::CrossProcessId operation_id, Web::HTML::HistoryStepResult);void end_history_operation(Web::HTML::CrossProcessId operation_id);void did_not_apply_reload(Web::HTML::CrossProcessId navigable_id);OwnPtr<HistoryOperation> take_history_operation(Web::HTML::CrossProcessId operation_id);- void report_history_operation_completion(HistoryOperation&, Optional<i32> committed_step);+ void report_history_operation_completion(HistoryOperation&);void settle_history_operation(NonnullOwnPtr<HistoryOperation>);HistoryOperation* ongoing_browser_history_traversal();