gecko-dev/browser/components/search/content
Drew Willcoxon 70e0b1acf5 Bug 1539804 - Quantumbar: Re-enable browser_urlbarStopSearchOnSelection.js and fix a couple of related problems. r=mak
This test uncovered a couple of problems:

(1) UrlbarController.handleKeyNavigation relies on event.defaultPrevented to tell whether the one-offs handled the key event. That's a problem when combined with deferring the down arrow key.

handleKeyNavigation is called twice in that case. The first time, the event is deferred (so executeAction = false), and handleKeyNavigation calls event.preventDefault. The second time, the event is being replayed, but defaultPrevented is true from the previous call regardless of whether the one-offs actually handled the event.

So handleKeyNavigation always returns early because it thinks the one-offs always handled the event, so it never properly replays down arrow keys.

(2) UrlbarProviderUnifiedComplete's query promise is never resolved when the query is canceled. That's a problem in general of course but I tripped over it in this test because I need to check results after the query is canceled, and the test ended up hanging since UrlbarTestUtils waits for the query to finish in order to get its results.

It's not a problem in UnifiedComplete itself per se because of course awesomebar uses UnifiedComplete too, and it doesn't have this problem. The difference is that nsAutoCompleteController::StopSearch calls input->OnSearchComplete() (via PostSearchCleanup): https://searchfox.org/mozilla-central/rev/b756e6d00728dda4121f8278a744381d8643317a/toolkit/components/autocomplete/nsAutoCompleteController.cpp#1433

Quantumbar's UnifiedComplete provider is missing that behavior, so this patch adds it by resolving its query promise when the query is canceled.

Differential Revision: https://phabricator.services.mozilla.com/D29300

--HG--
extra : moz-landing-system : lando
2019-05-01 17:42:19 +00:00
..
autocomplete-popup.js Bug 1525101 - Convert browser-search-autocomplete-result-popup into a Custom Element, r=MattN 2019-03-06 21:06:41 +00:00
search-one-offs.js Bug 1539804 - Quantumbar: Re-enable browser_urlbarStopSearchOnSelection.js and fix a couple of related problems. r=mak 2019-05-01 17:42:19 +00:00
search.xml Bug 1528268 - Make initializeAttributeInheritance and incremental attribute changes do less work r=aswan 2019-04-18 16:41:39 +00:00
searchbar.js Bug 1537117 - Update the search engine quick-switching functionality to work with an async SearchService API. r=florian 2019-04-02 14:15:35 +00:00