Repository navigation
Conversation
|
No actionable comments were generated in the recent review. Walkthrough
Change: Bug fix · Severity of issue fixed: Medium Merge Risk:
|
…ssion's Ardia's Target.getTargets can report a page with url "" for a few milliseconds while it navigates (seen 23-120 ms on Ardia 0.2.49, macOS, and in headless Chromium 156). refreshTargets only keeps targets whose URL has a page scheme, so it forgot the session's tab and with it the ownership: the next tab <id> failed with tab_not_found, and when the target came back at its new URL the session no longer owned it and couldn't close it. A page target already known keeps its last row while its URL is empty; a page first seen without an address is still left out. The tab_blank_url_kept flag is set on a command during which a known tab was listed without an address; watch its rate in cli_command. Closes ardia-browser/ardia#4665
11798a0 to
7d61a7a
Compare
Closes ardia-browser/ardia#4665
While a tab navigates,
Target.getTargetscan list the page withurl: ""for a few milliseconds.refreshTargetskeeps only targets whose URL starts with a page scheme, so it calledforgetTargeton the session's own tab, which dropsopened,createdand the app-tab pairing. With--pin-tabthe nexttab <targetId>then failed withtab_not_found. When the target came back at its new URL,tab listshowed it asopenedBySession: false, andtab closerefused it as one of the user's tabs. That matches the issue's report.Now a page target the session already knows keeps its last row while its URL is empty, and is updated when the real URL comes back. A page first seen without an address is still left out, as before. A new flag,
tab_blank_url_kept, is set on a command during which this happened. It is registered with the daemon (metrics.ts), the client (browse/tables.ts) andcli_command(command-metrics.ts), and the telemetry list inplugin.jsondescribes it (750 of 800 characters). Watch its rate incli_commandto see how often Ardia lists a tab with an empty URL.What Ardia reports during the navigation. Ardia 0.2.49 (build 141) on a Mac mini, macOS 27.0.1, hidden test instance, polling
Target.getTargetsevery 20 ms around the issue'sPage.navigate. NotargetDestroyedand no new target, just an empty URL for one poll (seen in 2 of 4 runs, 23 to 120 ms):Headless Chromium 156 does the same, so this isn't Ardia-only.
Before and after, in Ardia. Same Mac and build, through Ardia's own connection (
--data-dir). Each round runs the issue's exact steps (pinnedtab new,cdp Network.getAllCookies, bothnetwork routes,cdp Page.navigate), then 40 quicktab <targetId>lookups so the short window gets hit, thentab list,tab close <targetId>andclose. The base is maind87fc6cand the fix is this branch, both built withsh scripts/build.sh(Bun 1.3.14). Runs were interleaved, 12 rounds each:tab closerefusedd87fc6cd87fc6c, with every lookup error caughtA base round, the same failure as the issue:
A round on this branch:
On Linux against headless Chromium 156, the same harness lost the tab in 7 of 8 rounds on the base and in 0 of 8 on this branch. The issue's original single script didn't fail on either build in these runs, because it only hits the window by chance.
Tests. The new
tests/m3/tabs-nav.test.tscase ("a pinned session still finds its own tab by target id, and keeps it") fails on main withTab TARGET not foundand passes here. The second new case checks that a page first seen with an empty URL is still left out. On Linux x64, these pass at7d61a7a(rebased onto #184):tsrs --noEmit -p .,tsrs --noEmit -p tests/m3,ts/dist/ardia-ts plugins check plugins/cli, andbun testoftests/m3/tabs-nav.test.ts(25),tests/arch-v3-tabtools.test.ts(8),tests/arch-v3-position-mouse.test.ts(5) andtests/m2c-computer.test.ts(3, three runs). The headless Chromium harness kept the tab in 8 of 8 rounds at7d61a7a. The Mac runs above are from65c7727, before the rebase; the fix is the same code. A replay also checked thattab_blank_url_keptreachescli_commandand a collector.CI at
7d61a7a. The vendored schema check and Manifest v2 pass. The red jobs fail in tests this change doesn't touch:daemon/waitsreplay intests/m3/replay-corpus.test.tsgets an extraPage.createIsolatedWorld. The same error shows on CLI: ardia feedback --help says a public GitHub issue may be opened, not that one always is #182 (run 46038200441), which changes only help text and test fixtures.tests/shipping/plugin-mode.test.tsends from SIGINT itself instead of exiting with 130, after its 700 ms wait.a86ff86too (run 46186410358), on "the link > commands, events, frames and errors", which passes here.tests/m2c-computer.test.ts, which never reported. That file passes locally, in three runs out of three.CLI checks passcollects these jobs, so it fails too.Not shown: a green full
bun run testorbun run test:parityat this head, for the reasons above.The stress harness