Repository navigation
fix(web-watcher): don't walk Firefox page content to find the URL bar - #422
Conversation
The URL bar lookup walks the active window depth-first. Firefox places the page's WebView ahead of the toolbar, so on a large page every accessibility event spent the whole 2000-node budget in getChild binder calls on the main thread, and usually never reached the URL bar. Skip the children of WebView nodes. Fixes ActivityWatch#421 Git-Session-Id: 18f46105-6b6d-4340-9042-0c7216e0dd30
[Medium impact] The PR appears safe to merge. SummaryThe PR skips children of
Reviews (1) · Last reviewed commit: "fix(web-watcher): don't walk Firefox pag..." · Reviewed by Greptile |
|
CI-green and mergeable (Greptile 5/5) — waiting only on a maintainer click. This PR is ready to merge, but the bot has pull-only access to this repo and can't self-merge — surfacing it here so it isn't lost. The monitoring loop will stop re-flagging it now that this note is posted. |
🤖 AI code reviewAdds an optional Safe to merge — no P0/P1 findingsConfidence 5/5 ✅ No findings. The diff looks correct to me on this pass. Files changed (3) — the diff as I read it
Reviewed Maintainer commands
|
Fixes #421.
Cause
extractFirefoxUrlsearchesrootInActiveWindowdepth-first forADDRESSBAR_URL_BOX. In Firefox 160.0.1 the page'sandroid.webkit.WebViewnode sits underswipeRefresh, which comes beforecomposable_toolbar. The search therefore walks the page first. On a large page it spends the wholeMAX_TRAVERSAL_NODESbudget (2000getChildbinder calls) on the service's main thread, on every event, and usually never reaches the URL bar.Change
The URL bar search no longer fetches the children of
WebViewnodes.findNodegets an optionaldescendIntopredicate for this; other callers are unchanged.Verification
API 34 x86_64 emulator, Firefox 160.0.1, a local page with 3000 paragraphs (each a link and a button), load then six scroll swipes. "Truncated" counts the
NodeTraversal: ... hit node budget (2000)warnings:Url:log linesIn an earlier run on the release APK, consecutive truncation warnings were about 450 ms apart while scrolling, so the main thread had little idle time. I did not reproduce a system ANR dialog on the emulator, and I have not tested on the reporter's device.
:mobile:testStandardDebugUnitTest: 382 tests, 0 failures, including a new one fordescendInto.Not covered
getChildcan still block if Firefox's own UI thread is busy. Moving the lookup off the main thread would be a larger change.findWebViewsays page content is not a descendant of the window root. That did not match what I saw on 160.0.1, so Firefox page titles may be recoverable. I left that for a separate change.