Skip to content

armgit / moli

Public Imported from GitHub
0

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

fix(smoke): drain popup route callbacks before cleanup

ldm012a812d374ac
diff --git a/moli-cdp-smoke/moli_cdp_smoke/groups/core.py b/moli-cdp-smoke/moli_cdp_smoke/groups/core.py
index 101da9fb9..86ca26f7c 100644
--- a/moli-cdp-smoke/moli_cdp_smoke/groups/core.py
+++ b/moli-cdp-smoke/moli_cdp_smoke/groups/core.py
@@ -430,10 +430,13 @@ async def run_core_group(state: SmokeState) -> None:
)
finally:
first_popup_route_release.set()
+ # Removing interception can auto-continue the held request in the
+ # driver. Drain its callback before removing routes or closing Pages
+ # so its fulfill cannot race a second terminal action during cleanup.
+ await context.unroute_all(behavior="wait")
for popup in (first_popup, second_popup):
if popup is not None:
await popup.close()
- await context.unroute("**/popup-concurrent-*")
state.record("popup_context_route_concurrent_initial_documents")
await page.goto(f"{fixture}/plain", wait_until="load", timeout=10_000)