On undo/Ctrl+Z, autofill completes the URL without a selection and moves the caret to the end
Categories
(Firefox :: Address Bar, defect, P2)
Tracking
()
Tracking | Status | |
---|---|---|
firefox68 | --- | fixed |
People
(Reporter: mak, Assigned: adw)
References
Details
Attachments
(1 file)
While reproducing another bug, I hit this case.
I time a few random chars in the urlbar, starting from a, like "asdfwqekj", I press ctrl+Z, it changes to "asrock.com/"... At first I was surprised, then I noticed in my profile "as" autofills to asrock.com.
The big problem is that there's no selection, the site is just autofilled in place. I think we should not autofill in this case, but the old urlbar does autofill, with removable selection, that is already a better solution than what we have now.
Comment 2•6 years ago
|
||
(In reply to Marco Bonardo [::mak] from comment #1)
Didn't really mean to transform adw in a bug!
That's deep, man.
Reporter | ||
Updated•6 years ago
|
Assignee | ||
Updated•6 years ago
|
Assignee | ||
Comment 3•6 years ago
|
||
nsAutoCompleteController doesn't complete the default index when there's a text selection. iow selectionStart must == selectionEnd for autofill to happen due to processing the first result. UrlbarInput doesn't have that restriction, which is why this happens in quantumbar but not awesomebar.
Specifically, nsAutoCompleteController returns here: https://searchfox.org/mozilla-central/rev/dd7e27f4a805e4115d0dbee70e1220b23b23c567/toolkit/components/autocomplete/nsAutoCompleteController.cpp#1475
And UrlbarInput does the autofill in this bug here: https://searchfox.org/mozilla-central/rev/dd7e27f4a805e4115d0dbee70e1220b23b23c567/browser/components/urlbar/UrlbarInput.jsm#488
I'd like to fix this bug by bring quantumbar to parity with awesomebar as I just described, and then file another bug for considering not autofilling at all when undoing. They're two separate tasks that we should consider separately imo. (We might be able to use editor's nsITransactionListener to listen for undo and prohibit autofill: https://searchfox.org/mozilla-central/rev/dd7e27f4a805e4115d0dbee70e1220b23b23c567/editor/txmgr/nsITransactionListener.idl#55 )
Assignee | ||
Comment 4•6 years ago
|
||
We need to handle autofilling the first result separately from autofilling results in general (which happens in UrlbarInput.setValueFromResult), so add a new UrlbarInput.autofillFirstResult method. The controller calls it instead of setValueFromResult. I ported the logic from nsAutoCompleteController, as described in the bug.
Other changes are related to the new test for this.
As part of this work, I was interested in learning how awesomebar handles browser_autoFill_typed.js, so I added it to the legacy tests, with a small tweak in the test for awesomebar.
Assignee | ||
Comment 5•6 years ago
|
||
Assignee | ||
Comment 6•6 years ago
|
||
Updated•6 years ago
|
Assignee | ||
Comment 7•6 years ago
|
||
Comment 9•6 years ago
|
||
bugherder |
Assignee | ||
Comment 10•6 years ago
|
||
I filed bug 1545559 for specifically not autofilling on undo. I'll update this bug's summary so it's clear what we ended up fixing.
Description
•