Skip to content

armgit / moli

Public Imported from GitHub
0

Best headless browser for AI agents. Lite, Fast, High-Compatibility. Built in Rust

Fix dropped PendingStandaloneDocumentWritePage

ldm0ebcdcd0dcb77
diff --git a/moli-renderer-v8/src/runtime/phase_one/document_write_resource_tests.rs b/moli-renderer-v8/src/runtime/phase_one/document_write_resource_tests.rs
index 7c2071e87..bd6bf40f7 100644
--- a/moli-renderer-v8/src/runtime/phase_one/document_write_resource_tests.rs
+++ b/moli-renderer-v8/src/runtime/phase_one/document_write_resource_tests.rs
@@ -1029,16 +1029,19 @@ fn runtime_generation_mismatch_is_rejected_by_the_page_arbiter() {
Some(current_target),
"a mismatched generation must not consume the current pending load"
);
- let result = evaluate_pending_on_owner_local_task(
+ let (pending, result) = evaluate_pending_on_owner_local_task(
pending,
"String(globalThis.__staleGenerationScriptRan)",
)
- .await
- .1;
+ .await;
assert_eq!(result.get("value").and_then(serde_json::Value::as_str), Some("undefined"));
+ // Keep the pending page, and therefore its request client, alive until the server has
+ // accepted and served the current-generation script. Dropping it before this await can
+ // cancel the connect while the server is still blocked in `accept()`.
server
.await
.expect("current document.write script server should finish");
+ drop(pending);
}));
});
}