Closed Bug 1665292 Opened 4 years ago Closed 4 years ago

The view's selected result and UrlbarInput._resultForCurrentValue aren't cleared when the view is cleared.

Categories

(Firefox :: Address Bar, defect, P2)

defect
Points:
2

Tracking

()

RESOLVED FIXED
82 Branch
Iteration:
82.2 - Sep 7 - Sep 20
Tracking Status
firefox82 --- fixed

People

(Reporter: adw, Assigned: adw)

References

Details

Attachments

(1 file)

As I was working on bug 1659204, I found that both the view's selected result and UrlbarInput._resultForCurrentValue stick around after the view has been cleared and is therefore showing no results. That's conceptually wrong, and the practical effect I was seeing is that it interferes with UrlbarInput.handleNavigation. Without clearing the view's selected index, handleNavigation calls pickResult on it. Then, without clearing _resultForCurrentValue, handleNavigation calls pickResult on it. In either case, handleNavigation ends up loading a URL that isn't present in the current query's results.

First, UrlbarView.clear needs to null the selected element. Second, setting the selected element to null needs to also null UrlbarInput._resultForCurrentValue. UrlbarView._selectElement does call input.setValueFromResult, which sets _resultForCurrentValue -- but not if the updateInput arg is false. So I added a new UrlbarInput.setResultForCurrentValue method so _selectElement can set it. At first I tried unconditionally calling calling input.setValueFromResult, but a bunch of tests failed. I looked into it, but it's complicated and I ended up modifying a bunch of seemingly unrelated stuff, so I gave up and took the simple route by adding this new method.

This also makes some other changes that I'll comment on inline.

Pushed by dwillcoxon@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/9ba78b5783f6
Clear the view's selected result and UrlbarInput._resultForCurrentValue when the view is cleared. r=harry
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → 82 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: