Bug 1685798 Comment 0 Edit History

Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.

Profile: https://share.firefox.dev/2XmHztF

Steps to reproduce:
 1. Be logged in on bugzilla with an account that has editbugs rights.
 2. On this bug, click the Edit Bug button in the top right corner.
 3. Focus any of the form fields.

Expected results:
No jank, the form field should be responsive immediately.

Actual results:
The page hangs for a full second before input is accepted.

Here's a patch to add profiler markers to the relevant code:

```diff
diff --git a/browser/extensions/formautofill/FormAutofillHeuristics.jsm b/browser/extensions/formautofill/FormAutofillHeuristics.jsm
--- a/browser/extensions/formautofill/FormAutofillHeuristics.jsm
+++ b/browser/extensions/formautofill/FormAutofillHeuristics.jsm
@@ -1101,17 +1101,20 @@ this.FormAutofillHeuristics = {
    * @param {Array<string>} regexps
    *        The regex key names that correspond to pattern in the rule list.
    * @returns {?string} The first matched field name
    */
   _findMatchedFieldName(element, regexps) {
     const getElementStrings = this._getElementStrings(element);
     for (let regexp of regexps) {
       for (let string of getElementStrings) {
-        if (this.RULES[regexp].test(string)) {
+        let startTime = Cu.now();
+        let matched = this.RULES[regexp].test(string);
+        ChromeUtils.addProfilerMarker(`FormAutofill ${regexp} regexp`, startTime);
+        if (matched) {
           return regexp;
         }
       }
     }

     return null;
   },

```

In the call tree, it looks like some regular expressions get compiled repeatedly.
Profile: https://share.firefox.dev/2JYg2vt

Steps to reproduce:
 1. Be logged in on bugzilla with an account that has editbugs rights.
 2. On this bug, click the Edit Bug button in the top right corner.
 3. Focus any of the form fields.

Expected results:
No jank, the form field should be responsive immediately.

Actual results:
The page hangs for a full second before input is accepted.

Here's a patch to add profiler markers to the relevant code:

```diff
diff --git a/browser/extensions/formautofill/FormAutofillHeuristics.jsm b/browser/extensions/formautofill/FormAutofillHeuristics.jsm
--- a/browser/extensions/formautofill/FormAutofillHeuristics.jsm
+++ b/browser/extensions/formautofill/FormAutofillHeuristics.jsm
@@ -1101,17 +1101,20 @@ this.FormAutofillHeuristics = {
    * @param {Array<string>} regexps
    *        The regex key names that correspond to pattern in the rule list.
    * @returns {?string} The first matched field name
    */
   _findMatchedFieldName(element, regexps) {
     const getElementStrings = this._getElementStrings(element);
     for (let regexp of regexps) {
       for (let string of getElementStrings) {
-        if (this.RULES[regexp].test(string)) {
+        let startTime = Cu.now();
+        let matched = this.RULES[regexp].test(string);
+        ChromeUtils.addProfilerMarker(`FormAutofill ${regexp} regexp`, startTime);
+        if (matched) {
           return regexp;
         }
       }
     }

     return null;
   },

```

In the call tree, it looks like some regular expressions get compiled repeatedly.
Profile: https://share.firefox.dev/2JYg2vt

Steps to reproduce:
 1. Make sure your Firefox profile has Form Autofill enabled, by setting `extensions.formautofill.available` to `on` and restarting.
 2. Open the attached testcase. Alternatively, on this very bugzilla bug, click the Edit Bug button in the top right corner. (This only works if you're logged in and have editbugs rights.)
 3. In the "References" section, focus the "Depends on" text field and start typing immediately.

Expected results:
No jank, the form field should be responsive immediately.

Actual results:
The page hangs for a full second before input is accepted.

Here's a patch to add profiler markers to the relevant code:

```diff
diff --git a/browser/extensions/formautofill/FormAutofillHeuristics.jsm b/browser/extensions/formautofill/FormAutofillHeuristics.jsm
--- a/browser/extensions/formautofill/FormAutofillHeuristics.jsm
+++ b/browser/extensions/formautofill/FormAutofillHeuristics.jsm
@@ -1101,17 +1101,20 @@ this.FormAutofillHeuristics = {
    * @param {Array<string>} regexps
    *        The regex key names that correspond to pattern in the rule list.
    * @returns {?string} The first matched field name
    */
   _findMatchedFieldName(element, regexps) {
     const getElementStrings = this._getElementStrings(element);
     for (let regexp of regexps) {
       for (let string of getElementStrings) {
-        if (this.RULES[regexp].test(string)) {
+        let startTime = Cu.now();
+        let matched = this.RULES[regexp].test(string);
+        ChromeUtils.addProfilerMarker(`FormAutofill ${regexp} regexp`, startTime);
+        if (matched) {
           return regexp;
         }
       }
     }

     return null;
   },

```

In the call tree, it looks like some regular expressions get compiled repeatedly.
Profile: https://share.firefox.dev/2JYg2vt

Steps to reproduce:
 1. Make sure your Firefox profile has Form Autofill enabled, by setting `extensions.formautofill.available` to `on` and restarting.
 2. Open the attached testcase. Alternatively, on this very bugzilla bug, click the Edit Bug button in the top right corner. (This only works if you're logged in and have editbugs rights.)
 3. Focus the "Summary" text field at the top and start typing immediately.

Expected results:
No jank, the form field should be responsive immediately.

Actual results:
The page hangs for a full second before input is accepted.

Here's a patch to add profiler markers to the relevant code:

```diff
diff --git a/browser/extensions/formautofill/FormAutofillHeuristics.jsm b/browser/extensions/formautofill/FormAutofillHeuristics.jsm
--- a/browser/extensions/formautofill/FormAutofillHeuristics.jsm
+++ b/browser/extensions/formautofill/FormAutofillHeuristics.jsm
@@ -1101,17 +1101,20 @@ this.FormAutofillHeuristics = {
    * @param {Array<string>} regexps
    *        The regex key names that correspond to pattern in the rule list.
    * @returns {?string} The first matched field name
    */
   _findMatchedFieldName(element, regexps) {
     const getElementStrings = this._getElementStrings(element);
     for (let regexp of regexps) {
       for (let string of getElementStrings) {
-        if (this.RULES[regexp].test(string)) {
+        let startTime = Cu.now();
+        let matched = this.RULES[regexp].test(string);
+        ChromeUtils.addProfilerMarker(`FormAutofill ${regexp} regexp`, startTime);
+        if (matched) {
           return regexp;
         }
       }
     }

     return null;
   },

```

In the call tree, it looks like some regular expressions get compiled repeatedly.

Back to Bug 1685798 Comment 0