Repository navigation
Conversation
… yet onPageFinished can deliver ANDROID_THEME_HOOK_JS into a document that has not parsed its root element yet, when the previous navigation finishes after the next one started. document.documentElement is then null, and observing it threw, aborting the whole hook before checkSettled() ran. That document could never report settlement, so the WebView stayed hidden for good. Observe document.documentElement || document instead: the Document covers the same subtree and survives the empty-document window. Evidence: ActivityWatch/aw-android master run 39307023808 (Build, commit 68947c0) failed DashboardThemePaintTest with 'Timed out waiting for WebView state' at the final reveal, and the only console error in the emulator logcat was this exact throw at hook line 76. Git-Session-Id: 21420750-d15e-5941-9b24-25826fcda305
Git-Session-Id: 79c7f0bd-b70a-4964-b470-e6daef89d73e
[Medium impact] The PR appears safe to merge; no actionable issues were found. SummaryAdds a real WebView regression test for installing
TimeToBuildBob explicitly leaves the separate native navigation-tag race out of scope; this PR does not claim to fix it. Reviews (1) · Last reviewed commit: "test(webview): execute theme hook while ..." · Reviewed by Greptile |
Contributor
Author
|
Greptile reviewed |
This was referenced Oct 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds a real WebView instrumentation test for the rootless-document theme-hook failure fixed by #375. The JVM source-string assertion cannot show whether the hook actually survives
document.documentElement === null.The test loads an isolated fixture, removes its root, injects the production
ANDROID_THEME_HOOK_JS, checks installation succeeded without reporting settlement, restores#app/#wrapper, and verifies the bridge receives the expected navigation token exactly once. More mutations and a repeated injection must not produce a second report. The WebView is destroyed infinally; no server, app preferences or permission changes are needed.Dependency
Includes the existing #375 fix commit unchanged, followed by one test-only commit. Merge #375 first; after that this PR reduces to the instrumentation test. This does not edit the monitored #375 branch or add another production fix.
Verification
Executed on Bob's remote KVM Android 14
gptme-testemulator:68947c0plus new test: fails withTypeError: Failed to execute 'observe' on 'MutationObserver': parameter 1 is not of type 'Node'.11c7f31: 1 test passed,BUILD SUCCESSFUL../gradlew --no-daemon :mobile:connectedStandardDebugAndroidTest -Pandroid.testInstrumentationRunnerArguments.class=net.activitywatch.android.RootlessThemeHookTest.make test-e2e-mainincludes this class automatically; no workflow change is needed. Full CI is pending, not claimed green.This is behavioral regression coverage, not a claim that the separate native navigation-tag race is fixed. The fixture uses the light theme to isolate missing-root observation from stylesheet-loading behavior already covered by
DashboardThemePaintTest.