Open Bug 2092809 Opened 18 days ago Updated 18 days ago

GeckoSession.containsFormData() returns true for pages the user never interacted with, inflating Fenix's tab_killed had_form_data telemetry

Categories

(GeckoView :: General, defect)

All
Android
defect

Tracking

(Not tracked)

People

(Reporter: kaya, Assigned: kaya)

References

Details

(Whiteboard: [fxdroid][group6])

GeckoSession.containsFormData() (bug 1777506) is meant to tell whether a page has unsubmitted user input ("An unsubmitted form is a signal that the user is still working on the page"). Fenix uses it to give such tabs HIGH process priority for 3 minutes after the user leaves them (bug 1800146), and to report engine_tab.tab_killed's had_form_data extra (bug 1820211). In practice it returns true for pages that just contain form fields, even if the user never touched them.

GeckoViewContentChild.containsFormData runs session restore's whole-page collector, SessionStoreUtils.collectFormData, followed by PrivacyFilter.filterFormData. GeckoView sets browser.sessionstore.privacy_level to 0, so the filter passes everything through. The collector was written for session restore, where saving too much is harmless, so it counts untouched single-select <select>s, any <textarea> (even empty or hidden), and input values set by page script.

Steps to reproduce (Fenix, adb logcat | grep SessionPrioritizationMiddleware):

  1. Open a page containing only an untouched <select>, e.g. <select><option>en</option><option>de</option></select>.
  2. In a new tab, open a page with no form fields.
  3. In a third tab, open a page containing only an empty <textarea></textarea>.
  4. Switch between the tabs without interacting with any page, ending on the page with no form fields.

Actual:

  • Leaving the <select> page and leaving the <textarea> page each log "Update the tab <id> priority to HIGH" and "Tab <id> will return to DEFAULT priority after 180000 ms". That means containsFormData() returned true, and both tabs get a HIGH priority boost.
  • Leaving the page with no form fields logs "Update the tab <id> priority to DEFAULT".
  • After killing the shared content process (adb root, adb shell kill -9 <pid>) while the page with no form fields was selected, Glean recorded three engine_tab.tab_killed events:
    {"foreground_tab": "false", "app_foreground": "true", "had_form_data": "true"} (untouched <select> / empty <textarea> page)
    {"foreground_tab": "false", "app_foreground": "true", "had_form_data": "true"} (untouched <select> / empty <textarea> page)
    {"foreground_tab": "true", "app_foreground": "true", "had_form_data": "false"} (page with no form fields)

Expected:

  • containsFormData() returns false for all three pages, since the user didn't interact with any of them, and no tab gets the priority boost.
You need to log in before you can comment on or make changes to this bug.