Skip to content

Truly independent web browser

LibWeb: Drop null checks on a history step job's target entry

Shannon Boothaca91c540ef4
diff --git a/Libraries/LibWeb/HTML/HistoryExecutor.cpp b/Libraries/LibWeb/HTML/HistoryExecutor.cpp
index aaa8ff56981..e589672de69 100644
--- a/Libraries/LibWeb/HTML/HistoryExecutor.cpp
+++ b/Libraries/LibWeb/HTML/HistoryExecutor.cpp
@@ -847,10 +847,6 @@ void HistoryExecutor::run_ui_changing_navigable_history_job(CrossProcessId opera
} else {
local_target_entry = navigable->resolve_local_session_history_entry(move(target_entry));
}
- if (!local_target_entry) {
- on_complete->function()(ChangingNavigableHistoryStepJobDisposition::Stale, UnloadDisplayedDocument::No);
- return;
- }
auto did_claim_navigable = run_changing_navigable_history_step_job_impl(
{
.operation_id = operation_id,
diff --git a/Libraries/LibWeb/HTML/LocalNavigable.cpp b/Libraries/LibWeb/HTML/LocalNavigable.cpp
index f7f424ed401..8d223d4e825 100644
--- a/Libraries/LibWeb/HTML/LocalNavigable.cpp
+++ b/Libraries/LibWeb/HTML/LocalNavigable.cpp
@@ -1121,7 +1121,7 @@ void LocalNavigable::inherit_page_state_from(LocalNavigable const& parent)
}
// https://html.spec.whatwg.org/multipage/browsing-the-web.html#activate-history-entry
-void LocalNavigable::activate_history_entry(RefPtr<SessionHistoryEntry> entry, GC::Ref<DOM::Document> document)
+void LocalNavigable::activate_history_entry(NonnullRefPtr<SessionHistoryEntry> entry, GC::Ref<DOM::Document> document)
{
// AD-HOC: The document a provisional navigable populated activates: the navigable takes its container over first,
// so that the document is the content navigable's active document, and the WindowProxy's [[Window]], from
@@ -1142,7 +1142,6 @@ void LocalNavigable::activate_history_entry(RefPtr<SessionHistoryEntry> entry, G
// DocumentState identifies its associated Document by a process-local ID. Restore that association at the
// transition that makes a reconstructed entry's Document active.
- VERIFY(entry);
auto document_state = entry->document_state();
VERIFY(document_state);
document_state->set_document_id(new_document->unique_id());
diff --git a/Libraries/LibWeb/HTML/LocalNavigable.h b/Libraries/LibWeb/HTML/LocalNavigable.h
index 4b0da6c0722..92efe5a9f19 100644
--- a/Libraries/LibWeb/HTML/LocalNavigable.h
+++ b/Libraries/LibWeb/HTML/LocalNavigable.h
@@ -125,7 +125,7 @@ public:
NonnullRefPtr<SessionHistoryEntry> resolve_local_session_history_entry(SessionHistoryEntryDescriptor);
Vector<NonnullRefPtr<SessionHistoryEntry>> session_history_entries_for_navigation_api_from_ui_process(Vector<SessionHistoryEntryDescriptor>, NonnullRefPtr<SessionHistoryEntry> target_entry);
- void activate_history_entry(RefPtr<SessionHistoryEntry>, GC::Ref<DOM::Document>);
+ void activate_history_entry(NonnullRefPtr<SessionHistoryEntry>, GC::Ref<DOM::Document>);
void update_nonchanging_navigable_history_step_state(HistoryObjectLengthAndIndex, GC::Ref<GC::Function<void()>> on_complete);
void queue_navigation_api_state_clear_task();
void run_ui_descendant_unload_task(ChildNavigableDestruction, StopHostingAfterUnload, GC::Ref<GC::Function<void()>> on_complete);