diff --git a/moli-protocol-server/src/protocol_server/tests/websocket/prepared_document_actions.rs b/moli-protocol-server/src/protocol_server/tests/websocket/prepared_document_actions.rs index 256fe57a095..c7f754c494d 100644 --- a/moli-protocol-server/src/protocol_server/tests/websocket/prepared_document_actions.rs +++ b/moli-protocol-server/src/protocol_server/tests/websocket/prepared_document_actions.rs @@ -1421,9 +1421,21 @@ async fn websocket_cdp_prepared_document_open_does_not_append_history_on_adoptio json!({"discover": true}), ) .await; - // The asynchronous callback runs during a defer wait, outside parser - // script execution where document.open() would otherwise be ignored. - let html = "before-open"; + // A speculative script request does not prove parser EOF. Arm the + // callback at interactive so document.open() runs during the intended + // defer wait, outside the parser's script execution scope. + let html = r#"before-open +"#; let mut observed = begin_document_html(&mut socket, &session.session_id, &fixture, html).await; tokio::time::timeout(Duration::from_secs(10), fixture.requested.notified())