Skip to content

Truly independent web browser

LibWebView: Drop crash recovery's handling of an unapplied step

Shannon Booth631a2b00131c
diff --git a/Libraries/LibWebView/CanonicalTraversable.cpp b/Libraries/LibWebView/CanonicalTraversable.cpp
index 2b887d03576..bd46efa0e4e 100644
--- a/Libraries/LibWebView/CanonicalTraversable.cpp
+++ b/Libraries/LibWebView/CanonicalTraversable.cpp
@@ -1224,20 +1224,11 @@ void CanonicalTraversable::recover_from_web_content_process_crash(OnHistoryStepA
abandon_history_operations();
// The tab's document is reloaded, the crashed process having destroyed the one its entry holds.
- NonnullRefPtr reloading_entry = *m_session_history.get_the_target_history_entry(*this, target_step);
+ auto* reloading_entry = m_session_history.get_the_target_history_entry(*this, target_step);
+ VERIFY(reloading_entry);
reloading_entry->document_state->reload_pending = true;
session_history_changed();
- enqueue_browser_history_traversal(
- target_step,
- false,
- [this, reloading_entry, on_complete = move(on_complete)](Web::HTML::HistoryStepResult result, Optional<i32> committed_step) {
- if (result != Web::HTML::HistoryStepResult::Applied && reloading_entry->document_state->reload_pending) {
- reloading_entry->document_state->reload_pending = false;
- session_history_changed();
- }
- if (on_complete)
- on_complete(result, committed_step);
- });
+ enqueue_browser_history_traversal(target_step, false, move(on_complete));
}
RefPtr<WebContentPage> CanonicalTraversable::page_hosting(CanonicalNavigable const& navigable) const
diff --git a/Libraries/LibWebView/ViewImplementation.cpp b/Libraries/LibWebView/ViewImplementation.cpp
index 39f39fd6b16..6c47d9a91ff 100644
--- a/Libraries/LibWebView/ViewImplementation.cpp
+++ b/Libraries/LibWebView/ViewImplementation.cpp
@@ -3032,23 +3032,19 @@ void ViewImplementation::recover_current_session_history_entry_with_history_oper
auto current_url = current_entry ? current_entry->url : m_url;
set_url(current_url);
auto navigation_id = begin_webdriver_navigation(WebDriverNavigationCompletionSource::CrashRecovery);
- traversable().recover_from_web_content_process_crash([this, navigation_id](Web::HTML::HistoryStepResult result, Optional<i32> committed_step) {
- if (result == Web::HTML::HistoryStepResult::Applied) {
- if (committed_step.has_value())
- update_navigation_action_state();
- auto const* current_entry = traversable().session_history().current_entry();
- if (current_entry)
- set_url(current_entry->url);
-
- if (m_webdriver_navigation_observation.has_value()
- && m_webdriver_navigation_observation->navigation_id == navigation_id
- && m_webdriver_navigation_observation->completion_source == WebDriverNavigationCompletionSource::CrashRecovery) {
- m_webdriver_navigation_observation->history_operation_completed = true;
- if (m_webdriver_navigation_observation->load_completed)
- complete_webdriver_navigation(navigation_id);
- }
- } else {
- complete_webdriver_navigation(navigation_id);
+ traversable().recover_from_web_content_process_crash([this, navigation_id](Web::HTML::HistoryStepResult, Optional<i32> committed_step) {
+ if (committed_step.has_value())
+ update_navigation_action_state();
+ auto const* current_entry = traversable().session_history().current_entry();
+ if (current_entry)
+ set_url(current_entry->url);
+
+ if (m_webdriver_navigation_observation.has_value()
+ && m_webdriver_navigation_observation->navigation_id == navigation_id
+ && m_webdriver_navigation_observation->completion_source == WebDriverNavigationCompletionSource::CrashRecovery) {
+ m_webdriver_navigation_observation->history_operation_completed = true;
+ if (m_webdriver_navigation_observation->load_completed)
+ complete_webdriver_navigation(navigation_id);
}
dump_session_history("recovered-web-content-process-with-history-operation"sv);
});