Closed Bug 1697392 Opened 4 years ago Closed 2 years ago

Failing to get search suggestions with "FormHistoryClient constructed with both a formField and an inputName" error (Stop using formAutofill in SearchSuggestionsController)

Categories

(Firefox :: Search, defect, P2)

defect

Tracking

()

RESOLVED FIXED
113 Branch
Tracking Status
firefox113 --- fixed

People

(Reporter: mak, Assigned: standard8)

References

Details

(Whiteboard: [snt-scrubbed][search-techdebt])

Attachments

(3 files)

Sometimes search suggestions are not fetched and the console dumps a lot of "FormHistoryClient constructed with both a formField and an inputName" errors.

This is actually due to toolkit/components/satchel/nsFormFillController.cpp having a stuck mFocusedInput value. This value is set by startControllingInput and unset by stopControllingInput, so we're somehow missing the latter.

This actually happened to me when visiting about:preferences shortly after the browser startup, then mFocusedInput got stuck to the about:preferences search field, and when I tried to use the urlbar, FormFillController thought I was trying to access search-history from an input field.

I was not yet able to produce reproducible STR, it may be a race condition.

Ideally just focusing another autofill input field should exit the condition, since at that point startControllingInput would terminate the previous session.

I think we should stop using formAutofill in SearchSuggestionsController, and straight query FormHistory.jsm. We don't really need all the abstraction in the middle.

I found a possible way to reproduce this, it requires to restore previous session on startup, and have the last open tab be about:config. There's something with the focus change there not unregistering the controller. Didn't debug further yet.

OMG this gave me quite a laugh. about:config is definitely a 100% reliable way to reproduce it. I've been driving myself insane for days trying to figure out what happened. 1 error for every key pressed in the urlbar! I thought I must have broken one of my databases while experimenting with urlbar provider mods. I restarted like 50 times trying to figure out why sometimes it doesn't happen. I guess it just happens that when I'm testing with my real profile with like 300 tabs, I always restart/clear startup cache with my active tab on about pages because they load so much faster. So I was unknowingly reproducing it almost every time just by habit lol.

Summary: Failing to get search suggestions with "FormHistoryClient constructed with both a formField and an inputName" error → Failing to get search suggestions with "FormHistoryClient constructed with both a formField and an inputName" error (Stop using formAutofill in SearchSuggestionsController)
Whiteboard: [snt-scrubbed][search-techdebt]

I have a WIP patch for this, that I've had hanging around for a while.

Assignee: nobody → standard8
Status: NEW → ASSIGNED
Depends on: 1802122

This should cut out most of the abstraction in the middle of the nsIAutoComplete interfaces.

Depends on D162843

Attachment #9304905 - Attachment description: WIP: Bug 1697392 - Stop using formAutofill in SearchSuggestionsController - query FormHistory direct. → Bug 1697392 - Stop using formAutofill in SearchSuggestionsController - query FormHistory direct. r?mak!

This moves creating FormAutoCompleteResult out of the controller and into SearchSuggestions.
SearchSuggestions is only used for the autocomplete interface and so this simplifies the work for content search and address bar.

Depends on D162844

Blocks: 1822297
Pushed by mbanner@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/b5cc114309cd Fix logging when a remte search suggestion fails. r=mak https://hg.mozilla.org/integration/autoland/rev/cf20f4f809be Stop using formAutofill in SearchSuggestionsController - query FormHistory direct. r=mak,credential-management-reviewers,sgalich https://hg.mozilla.org/integration/autoland/rev/22cb2543a2a1 Simplify SearchSuggestionController to return the form history results, rather than an FormAutoCompleteResult. r=mak
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 113 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: