Commit 7535712f authored by Dimi's avatar Dimi
Browse files

Bug 1784860 - Do not use transform function for testConfidence pref r=sgalich

`parseFloat` returns NaN when we pass null to it.
Since we use "null" to distinguish the case when the pref is set or
not, this patch moves `parseFloat` inside the if statemenet so we only
call it when the pref is set.

Differential Revision: https://phabricator.services.mozilla.com/D154666
parent ace27f6e
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -512,7 +512,9 @@ class FieldScanner {

    // Used by test ONLY! This ensure testcases always get the same confidence
    if (lazy.FormAutofillUtils.ccHeuristicTestConfidence != null) {
      highestConfidence = lazy.FormAutofillUtils.ccHeuristicTestConfidence;
      highestConfidence = parseFloat(
        lazy.FormAutofillUtils.ccHeuristicTestConfidence
      );
    }

    return [highestField, highestConfidence];
+1 −3
Original line number Diff line number Diff line
@@ -1329,7 +1329,5 @@ XPCOMUtils.defineLazyPreferenceGetter(
  FormAutofillUtils,
  "ccHeuristicTestConfidence",
  "extensions.formautofill.creditCards.heuristics.testConfidence",
  null,
  null,
  pref => parseFloat(pref)
  null
);