Skip to content

Truly independent web browser

LibWeb+LibWebView: Mark clearing an unapplied reload's flag as AD-HOC

Shannon Booth3d399bb8850c
diff --git a/Libraries/LibWeb/HTML/LocalNavigable.cpp b/Libraries/LibWeb/HTML/LocalNavigable.cpp
index 946640e7451..059a315ef09 100644
--- a/Libraries/LibWeb/HTML/LocalNavigable.cpp
+++ b/Libraries/LibWeb/HTML/LocalNavigable.cpp
@@ -4277,7 +4277,8 @@ void LocalNavigable::reload(Optional<StorageSerializationRecord> navigation_api_
if (result == HistoryStepResult::Applied)
return;
- // NB: A reload that did not apply leaves no navigation behind to clear the pending flag.
+ // AD-HOC: The spec leaves reload pending set when the reload does not apply, so a later history step would
+ // reload the document anyway.
if (reloading_entry->document_state()->reload_pending()) {
reloading_entry->document_state()->set_reload_pending(false);
page().client().page_did_set_session_history_entry_document_state_reload_pending(
diff --git a/Libraries/LibWebView/CanonicalTraversable.cpp b/Libraries/LibWebView/CanonicalTraversable.cpp
index a6d0ae075c1..1aaae6d5934 100644
--- a/Libraries/LibWebView/CanonicalTraversable.cpp
+++ b/Libraries/LibWebView/CanonicalTraversable.cpp
@@ -672,7 +672,8 @@ void CanonicalTraversable::reload(OnHistoryStepApplied on_complete)
.user_involvement = user_involvement,
};
enqueue_history_operation(Application::the().allocate_ui_process_cross_process_id(), parameters, {}, next_sequence_number(), [this, reloading_entry, on_complete = move(on_complete)](Web::HTML::HistoryStepResult result, Optional<i32> committed_step) {
- // NB: A reload that did not apply leaves no navigation behind to clear the pending flag.
+ // AD-HOC: The spec leaves reload pending set when the reload does not apply, so a later history step would
+ // reload the document anyway.
if (result != Web::HTML::HistoryStepResult::Applied && reloading_entry->document_state->reload_pending) {
reloading_entry->document_state->reload_pending = false;
session_history_changed();