refactor(navigation): trim traversal seed candidates

This commit is contained in:
ldm0
2026-11-24 04:23:44 +08:00
committed by Donough Liu
parent 732d32dfd2
commit f074835ee4
2 changed files with 2 additions and 9 deletions
@@ -67,7 +67,7 @@ pub(crate) struct PendingLocationNavigation {
pub(crate) initial_document_environment:
Option<crate::runtime::RendererCapturedDocumentEnvironment>,
pub(crate) entry_seed: Option<NavigationHistoryEntrySeed>,
/// Applied by the renderer when it owns the followed navigation.
/// Resolved history handling for requests without a prebuilt entry seed.
pub(crate) history_mutation: Option<NavigationHistoryMutation>,
pub(crate) reserved_service_worker_client: Option<PendingReservedServiceWorkerClient>,
pub(crate) service_worker_client_navigate:
@@ -79,7 +79,6 @@ pub struct NavigationActivationSeed {
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct NavigationTraversalSeedCandidate {
pub current_url: Url,
pub target_url: Url,
pub seed: NavigationHistoryEntrySeed,
}
@@ -448,11 +447,9 @@ pub fn traversal_navigation_seed_candidate(
return None;
}
let current_url = Url::parse(&current_entry.url).ok()?;
let target_url = Url::parse(&target_entry.url).ok()?;
Some(NavigationTraversalSeedCandidate {
current_url,
target_url: target_url.clone(),
target_url,
seed: NavigationHistoryEntrySeed {
session_history: crate::SessionHistorySeed {
commit: crate::SessionHistoryCommit::Traverse,
@@ -948,10 +945,6 @@ mod tests {
let candidate =
traversal_navigation_seed_candidate(entries, 0, 1).expect("traversal candidate");
assert_eq!(
candidate.current_url.as_str(),
"https://example.test/current"
);
assert_eq!(candidate.target_url.as_str(), "https://example.test/target");
assert_eq!(candidate.seed.current_index, 1);
assert_eq!(