fix(navigation): let renderer requests supersede pending loads

Allow top-level navigation owner actions from the current Document through
the in-flight navigation gate so they can cancel the previous request.
Keep exact scheduler predecessors and Page residence validation in place.

Cover an unresponsive first request replaced by page JavaScript without
further client commands, and ensure only the replacement enters history.
This commit is contained in:
ldm0
2026-11-02 06:02:22 +08:00
parent 958707a7af
commit 036f2106dc
@@ -688,6 +688,17 @@ async fn websocket_cdp_renderer_navigation_replaces_pending_response_without_cli
["about:blank", source_url.as_str(), replacement_url.as_str()]
);
assert_eq!(history["result"]["currentIndex"], json!(2));
let history = cdp_runtime_evaluate_string(
&mut socket,
&session.session_id,
8,
"JSON.stringify(navigation.entries().map(entry => entry.url))",
)
.await;
assert_eq!(
serde_json::from_str::<serde_json::Value>(&history).unwrap(),
json!([source_url, replacement_url])
);
let _ = socket.close(None).await;
abort_test_cdp_server(protocol_server).await;