the Quantum bar input field intermittently stops handling LEFT/RIGHT/HOME/END key events
Categories
(Firefox :: Address Bar, defect, P1)
Tracking
()
Tracking | Status | |
---|---|---|
firefox68 | --- | fixed |
People
(Reporter: mak, Assigned: adw)
References
Details
Attachments
(2 files)
Both me and Dao this morning hit this, but so far we don't have any hints about what may cause it, nor steps to reproduce, I'm filing this anyway to track the problem, and in case someone figures out useful information.
Apparently this started in today's nightly, but we can't be sure because it's intermittent, potentially patches landed yesterday may be on the hook.
If you hit this and can do some investigation through the Debugger, it would be nice, I'll also try to reproduce it.
Reporter | ||
Comment 1•6 years ago
|
||
I forgot the symptoms: basically HOME,END,LEFT,RIGHT stop working, it's not possible to move the cursor for the whole session (likely works in a new window, didn't try)
Updated•6 years ago
|
Updated•6 years ago
|
Comment 2•6 years ago
|
||
Sounds like a widget bug to me, TBH.
Reporter | ||
Comment 4•6 years ago
|
||
oh yeah, that's a good hint, I can also reproduce after customizing. Thanks for STR.
Assignee | ||
Updated•6 years ago
|
Assignee | ||
Comment 6•6 years ago
|
||
Looks like this is related to the input field's CopyCutController. When I comment out this line here, the problem goes away: https://searchfox.org/mozilla-central/rev/7944190ad1668a94223b950a19f1fffe8662d6b8/browser/components/urlbar/UrlbarInput.jsm#169
Still investigating.
Assignee | ||
Comment 7•6 years ago
|
||
Or rather it's the inputField.controllers.removeControllerAt(0) call in uninit. I'm guessing we end up removing the controller that handles the left/right arrow keys, if that's even a thing?
Assignee | ||
Comment 8•6 years ago
|
||
When UrlbarInput.uninit is called after customize mode ends, uninit calls this.inputField.controllers.removeControllerAt(0), which is supposed to remove the input's CopyCutController inserted in the constructor. But the controller at index 0 at that point is not the CopyCutController. Instead it's some built-in controller that supports these commands (at least these): cmd_charPrevious, cmd_charPrevious, cmd_beginLine, cmd_endLine. (Verified by adding logging to nsXULControllers::GetControllerForCommand.) That's why arrow left/right and home/end don't work after ending customize mode.
The problem is that this.inputField.controllers in the constructor and this.inputField.controllers in uninit (when customize mode ends) are not the same. I wasn't able to track down why, but I'm guessing that the textbox or something in its state is being reset or cloned when customized mode ends or maybe right after it starts. The CopyCutController isn't in the controllers array at all on uninit. (Verified by adding support for cmd_adw and iterating through the controllers array, looking for a controller supporting cmd_adw.)
Note that urlbarBindings.xml has a try-catch around removeController(), I'm guessing for what turns out to be this reason: https://searchfox.org/mozilla-central/rev/7944190ad1668a94223b950a19f1fffe8662d6b8/browser/base/content/urlbarBindings.xml#190
However, CopyCutController is in the controllers array when customize mode starts. So I added a new gURLBarHandler.customizeStart method that calls a new UrlbarInput.removeCopyCutController method.
Other things I tried or thought of doing:
Call gURLBarHandler._reset on customize start instead of end. Problem with that is that the UrlbarInput ends up getting immediately recreated because some other parts of the browser access gURLBar at that time. (Of course I replaced the gURLBar = this.urlbar
assignment in _reset with another lazy getter definition.)
Just don't worry about removing CopyCutController at all. That seems bad because then we'd leak it, unless the controller is removed or the controllers array is emptied at some point by XUL, and I'm not at all certain about that. (Although I guess this is effectively what awesomebar does, given the link above!)
Assignee | ||
Comment 9•6 years ago
|
||
Assignee | ||
Comment 10•6 years ago
|
||
With the new test and fresh tree: https://treeherder.mozilla.org/#/jobs?repo=try&revision=895cc04edc0a26c5138ba98980d62f7cb90039ed
Comment 11•6 years ago
|
||
Comment 12•6 years ago
|
||
bugherder |
Description
•