Closed Bug 1773918 Opened 2 years ago Closed 2 years ago

Fix problems with the autofill placeholder

Categories

(Firefox :: Address Bar, defect, P1)

Desktop
All
defect
Points:
3

Tracking

()

VERIFIED FIXED
103 Branch
Tracking Status
firefox103 --- verified

People

(Reporter: adw, Assigned: adw)

References

Details

Attachments

(1 file)

+++ This bug was initially created as a clone of Bug #1773025 +++

Spinning this out from bug 1773025 to fix the flickering problem (problem 1 I called it) plus some other problems I found with the autofill placeholder.

This fixes some problems with the autofill placeholder and improves the test.
Not all the problems are related to adaptive history autofill. They are:

  1. When the first result arrives and it's not an autofill, the placeholder
    should be cleared. This fixes the flickering I noted in bug 1773025.
  2. When the placeholder is example.com/shallow/deep/ and a search for
    example.com/s starts, the placeholder should not be autofilled.
  3. When the placeholder was created due to adaptive history autofill and a new
    search starts, we should use different logic from origin and URL autofill to
    determine if the placeholder can be autofilled. We need to make sure the
    placeholder starts with the search string and the search string is at least
    as long as the adaptive history input.

To fix problem 3, I changed _autofillPlaceholder from a string to an object
that stores much of the same data that is in result.autofill. This lets us
make smarter decisions about autofilling the placeholder.

I also refactored and renamed some functions so hopefully the code is easier to
understand.

Finally I mostly rewrote the placeholder test so it's also easier to understand,
and I added many test cases for the problems above. Since I'm modifying this
test anyway, I moved the adaptive history autofill placeholder tests from their
own file to the main test.

Pushed by dwillcoxon@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/b4f6fb035220
Fix problems with the autofill placeholder. r=daisuke
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 103 Branch

STR for QA

Case 1

  1. Visit https://www.nytimes.com/section/world
  2. Open a new tab and close the tab from the previous step
  3. Start typing "nytimes"
  4. With each character you type, verify "nytimes.com/" is autofilled in the input
  5. Move the caret to the end and start typing "section" so that the input will contain "nytimes.com/section"
  6. With each character you type, verify "nytimes.com/section/" is autofilled
  7. Move the caret to the end and start typing "world" so that the input will contain "nytimes.com/section/world"
  8. With each character you type, verify "nytimes.com/section/world" is autofilled
  9. Highlight "times.com/section/world" in the input. "ny" should not be highlighted, and everything after "ny" should be highlighted.
  10. Type a "t" character so that the input contains "nyt"
  11. Verify "nytimes.com/" is autofilled

Case 2

  1. Set browser.urlbar.autoFill.adaptiveHistory.enabled to true
  2. Visit https://www.nytimes.com/section/world
  3. Open a new tab and close the tab from the previous step
  4. Type "nyti" and pick the https://www.nytimes.com/section/world result in the urlbar panel
  5. Open a new tab and close the tab from the previous step
  6. Type "nyt"
  7. With each character you type, verify "nytimes.com/" is autofilled
  8. Continue typing the rest of "nytimes.com/section/world"
  9. With each character you type, verify "nytimes.com/section/world" is autofilled and there is no flickering of the selection in the input
  10. Highlight "times.com/section/world" in the input. "ny" should not be highlighted, and everything after "ny" should be highlighted.
  11. Type a "t" character so that the input contains "nyt"
  12. Verify "nytimes.com/" is autofilled
Flags: qe-verify+
Flags: in-testsuite+

The issue is verified fixed using the latest Fx103.0a1 build on Windows 10 and Ubuntu 20.04. Both scenarios were covered and the desired outcome is reached in both cases.

Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: