GeckoViewNavigation.onLocationChange and LoadURIDelegate report hasUserGesture from the document's transient
user activation at the time they run, and that activation expires after dom.user_activation.transient.timeout
(5 s). When the tapped page takes longer than that to commit its navigation on a slow emulator the flag reads
false. Raising the timeout for these two tests keeps them from depending on load speed.
Details
- Reviewers
ohall - Group Reviewers
geckoview-reviewers - Commits
- rFIREFOXAUTOLAND9d2f10e6a897: Bug 2055366 - Keep the transient user activation alive in the user gesture…
- Bugzilla Bug ID
- 2055366
Diff Detail
- Repository
- rFIREFOXAUTOLAND firefox-autoland
Event Timeline
(Reviewing Diff 1381930)
Summarization
Intent
The changes aim to fix an intermittent test failure in NavigationDelegateTest#locationReplaceOnUserGesture (and the related userGesture test). The root cause is a race condition: the tests simulate a user tap to trigger a navigation, and then check that the navigation reports hasUserGesture as true. However, hasUserGesture is derived from the document's transient user activation, which expires after a default timeout of 5 seconds (dom.user_activation.transient.timeout). On slow emulators, the navigation may take longer than 5 seconds to commit, causing the transient user activation to expire before GeckoViewNavigation.onLocationChange reads it, resulting in hasUserGesture being false and the test failing intermittently.
Solution
The fix adds a call to sessionRule.setPrefsUntilTestEnd at the beginning of both the userGesture and locationReplaceOnUserGesture tests, setting the dom.user_activation.transient.timeout preference to 60000 milliseconds (60 seconds). This greatly extends the window during which the transient user activation remains valid, ensuring that even on slow test environments the activation will not expire before the navigation commits and the hasUserGesture flag is read. The preference is scoped to the duration of each test, so it does not affect other tests. The commit message also notes that whether the user gesture flag should be captured at navigation start time (rather than at commit time) is a separate API design question.