mirror of
https://github.com/9prodhi/camoufox-rs.git
synced 2026-11-30 00:00:48 +00:00
Tabs a site opens itself (target=_blank, window.open) were attached by the browser but never usable: pages existed only inside new_main_frame's temporary listeners. Each BrowserContext now has a PageRegistry that tracks every page target, its frames and their main-world execution contexts from the moment Browser.attachedToTarget arrives. new_main_frame claims its own target from the registry; targets with an openerId (verified on Camoufox for both target=_blank and window.open) are popups. The CLI adopts popups as the next pN on each command, shows `opener` in `tabs`, reports "page <id> was closed" for detached tabs, and lists crashed tabs as crashed. Design points hardened over four review rounds (GPT-6.1-sol + Fable 5.2, each fix revert-proven): - connection handlers hold only Weak refs; MainFrame/BrowserContext own the registry, which owns its root subscriptions (no Arc cycle, pages keep working after the context handle is dropped) - the reader drops a detached session's handlers outside the connection lock; guards are never dropped and the connection never called while the registry lock is held - one tracker per frame id with a stable main-frame tracker; contexts can arrive before frameAttached without being misfiled; the main frame id is resolved live and once per operation - claim is atomic and refuses double ownership; claim fails fast when the connection closes; abandoned targets (failed newPage/claim window) are closed in the background instead of turning into phantom popups - Connection::drop on the reader thread no longer waits on itself Library behaviour changes are listed in CHANGELOG (Unreleased). Implemented by agy (gemini-3.8-flash-high) and pi (openai/gpt-6.1-sol); reviewed by GPT-6.1-sol, Fable 5.2 and Claude. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YQU84X3UzxGaxqrADxbkoE
10 lines
153 B
HTML
10 lines
153 B
HTML
<!doctype html>
|
|
<html>
|
|
<head><title>Self Closing</title></head>
|
|
<body>
|
|
<script>
|
|
setTimeout(() => window.close(), 300);
|
|
</script>
|
|
</body>
|
|
</html>
|