Open Bug 1743451 Opened 3 years ago Updated 3 years ago

Improve FormAutofillHeuristics.jsm

Categories

(Toolkit :: Form Autofill, task, P3)

task

Tracking

()

People

(Reporter: serg, Unassigned)

References

(Blocks 1 open bug)

Details

Let's walk over that file and see what can be improved, simplified or generalized.

Random thoughts:

  • For example, RegExpListCache can be restructured a bit to deal with cache concern in one fn only.
  • Perhaps there are more generic ways to specify patterns we are trying to classify sections.
  • There is an overlap with heuristicsRegexp.js, there must be a way to remove copy/paste.
  • _parsePhoneFields() looks complicated, a lot of index based operations
Blocks: 1737329
Priority: -- → P3
Severity: -- → N/A

Something we can do for _getRegExpList is simplify and/or remove the cache entirely.
An example of simplifying the _getRegExpList:

const key = {
  isAutoCompleteOff,
  isAutofillCreditCardsAvailable: FormAutofill.isAutofillCreditCardsAvailable,
  isSelectElem
};

let entry = this._regexpList.get(key);
if(!entry) {
  entry = this._computeEntry(key);
  this._regexpList.set(key, entry);
}

return entry;

In _parseAddressFields we need to determine why we are using the "1" character in the various address-line regex and not using the "1" character in these same regexs in heuristicsRegexp.js. Fathom may help handle this case in the future.

In _parsePhoneFields we can simplify the function into more logical chunks in order to increase readability of the code. There's also the potential that Fathom could handle some of the lifting of the this function, thus simplifying the heuristics code.

Component: about:logins → Form Autofill
Product: Firefox → Toolkit

The product::component has been changed since the backlog priority was decided, so we're resetting it.
For more information, please visit auto_nag documentation.

Priority: P3 → --
Priority: -- → P3
You need to log in before you can comment on or make changes to this bug.