Commit Graph

85 Commits

Author SHA1 Message Date
Daisuke Akatsuka
1c4aedcd22 Bug 1686951: Support switch-to-tab in private browsing window. r=adw
Differential Revision: https://phabricator.services.mozilla.com/D117974
2021-06-21 01:33:26 +00:00
Harry Twyford
d6fa112502 Bug 1662172 - Part 3 - Port and combine test_keyword_search and test_keyword_search_action. r=adw
Depends on D116899

Differential Revision: https://phabricator.services.mozilla.com/D116900
2021-06-17 22:04:54 +00:00
Harry Twyford
4f3830a020 Bug 1712352 - Part 3 - Add and fix tests for about page results. r=adw
Differential Revision: https://phabricator.services.mozilla.com/D115724
2021-06-03 19:32:15 +00:00
Sandor Molnar
3b5862183b Backed out 3 changesets (bug 1712352) for causing mochitest failures in browser_quicksuggest_indexes. CLOSED TREE
Backed out changeset 93148e04d432 (bug 1712352)
Backed out changeset 79b0ab821ddd (bug 1712352)
Backed out changeset 02842401765b (bug 1712352)
2021-06-03 17:49:45 +03:00
Harry Twyford
6576f0699c Bug 1712352 - Part 3 - Add and fix tests for about page results. r=adw
Differential Revision: https://phabricator.services.mozilla.com/D115724
2021-06-03 13:24:11 +00:00
Harry Twyford
73746decdd Bug 1677126 - Part 4 - Port remote tab tests and update them to expect result flex. r=adw
Differential Revision: https://phabricator.services.mozilla.com/D114895
2021-06-02 22:43:29 +00:00
Daisuke Akatsuka
e1a52bb35c Bug 1711156: Deduplicate unit converter results with search suggestions. r=adw
Differential Revision: https://phabricator.services.mozilla.com/D115162
2021-05-19 03:07:38 +00:00
Mark Banner
b9cc3ee370 Bug 1697477 - Use the new nsISearchEngine.isWebEngine property in the urlbar. r=mak
Differential Revision: https://phabricator.services.mozilla.com/D109548
2021-03-29 18:10:30 +00:00
Mark Banner
4a52d67ef9 Bug 1700971 - Switch to using search engine extensions in urlbar xpcshell-tests. r=mak
This allows us to use random port numbers in the tests, so that they can run in parallel.

Differential Revision: https://phabricator.services.mozilla.com/D109753
2021-03-26 22:12:43 +00:00
Mark Banner
57b96b5201 Bug 1687932 - Remove use of nsISearchEngine.addEngineWithDetails from other xpcshell-tests. r=harry
Differential Revision: https://phabricator.services.mozilla.com/D108462
2021-03-19 14:06:06 +00:00
Drew Willcoxon
d76fb3ca6a Bug 1691855 - Fix intermittent TV failure in browser/components/urlbar/tests/unit/test_resultBuckets.js. r=mak
The problem is that the test creates and registers many providers but never
unregisters them. Usually that's not a problem since test providers have random
names and test query contexts are created with the `providers` option. But
sometimes two different providers end up with the same name because
`Math.random() * 100000` ends up being the same. Therefore a context can end up
with two (duplicate) providers when there should be only one, which means
`context.results` ends up with two copies of each result.

This patch makes several changes:

* test_resultBuckets.js now unregisters providers.
* Stop using `Math.random()` as the basis for making random test provider
  names. Instead, use UUIDs.
* Add a `registerCleanupFunction` in head.js for unregistering test providers
  (even though that wouldn't have fixed this bug).
* Make `registerBasicTestProvider` return the provider instead of its name so
  that the provider can be passed to
  `UrlbarProvidersManager.unregisterProvider()`.

Differential Revision: https://phabricator.services.mozilla.com/D104929
2021-02-12 16:23:52 +00:00
amy churchwell
de63a13a51 Bug 1665066 - Remove payload.keywordOffer in favor of payload.providesSearchMode. r=harry
Differential Revision: https://phabricator.services.mozilla.com/D101414
2021-01-14 18:45:25 +00:00
Marco Bonardo
41567f5e8f Bug 1676038 - Change partial tab-to-search matching to avoid autofilling unexpected subdomains. r=adw
The previous approach was autofilling partial subdomains from search engines.
Having a search engine pointing to "developer.mozilla.org, when "moz" was typed
we ended up autofilling "moz[illa.org]" but pointing to "developer.mozilla.org".
Unfortunately that made impossible to actually go to "mozilla.org" by typing it.

The new approach instead allows tab-to-search results to appear even if there's
no autofill, because the provider checks autonomously the autofill threshold.
There's a downside though, with the old approach we could return more partial
matches, and the Muxer would pick one, depending on the autofilled host. For
example we could return "rover.ebay.com" and match it to "eb[ay.it]".
With the new approach we don't have an autofilled host, and fetching it would
be expensive, we can only compare the search string with the engine's host.
For this reason the patch also tries to partially match against the searchForm
host, that often points to a page the user visits more often.

Differential Revision: https://phabricator.services.mozilla.com/D96942
2020-11-18 15:26:58 +00:00
Harry Twyford
54265feb7c Bug 1647923 - Add UrlbarProviderTabToSearch. r=adw,fluent-reviewers
This patch adds tab-to-search results, partially reusing the existing code in `UrlbarProviderAutofill._matchSearchEngineDomain`. Tests are included. Telemetry is included in a child revision.

This patch doesn't add the "Search <engine name> directly from the address bar." action text. Our current action text code l10n is in a .properties file and I thought adding branching translation logic in UrlbarView would be a mess. I think Marco might be converting that .properties file to Fluent in bug 1658629. If he is, I'll rebase my patch on his and add the new action text it in this patch. If he isn't, I'll file a follow-up for converting that .properties file and adding the tab-to-search action text, which we can address before preffing `update2.tabToComplete` on. Either way, I think this is ready for a first-round review.

This patch is based on D91076 and D91077. It doesn't have any functional dependency, but there are some conflicts, especially in the added telemetry.

Differential Revision: https://phabricator.services.mozilla.com/D91468
2020-09-30 00:22:03 +00:00
Drew Willcoxon
4947a1ab4a Bug 1658964 - Convert local restriction chars to search mode and make other improvements to search mode. r=harry
Summary of major changes:

* Bookmarks, history, and tabs restriction chars now enter search mode. I added
  a method to UrlbarProviderHeuristicFallback to return a result with a keyword
  when one of these is used.
* This fixes other bugs like recognizing aliases that are entered at the
  beginning of non-empty search strings, and not quasi-re-entering search mode
  when search mode is already entered and you type another alias.
* The heuristic now determines whether we enter search mode, similar to how it
  also determines whether we autofill. When the heuristic has a keyword but no
  keyword offer, and the keyword is one of the recognized search mode keywords,
  then we enter search mode, cancel the current query, and start a new query
  with the remainder of the search string after the keyword.
* I slightly changed how we detect an alias, but only when update2 is
  enabled. Now, an alias must be followed by a space; otherwise, the alias is
  not recognized and instead just remains part of the seach string. Because if
  we don't do that, then you end up in a strange situation after typing an alias
  but before pressing space: The heuristic says "Search with <engine with the
  alias>", but we haven't entered search mode yet because you haven't typed a
  space yet. This is true for both @aliaes and non-@aliases.
* A consequence of the previous point is that we can still autofill @aliases
  with a trailing space, which IMO is important. Then, once the user types any
  char (space or not), we immediately enter search mode with the query being
  whatever char they typed. This is less important after bug 1658605 landed, but
  it's still good to have.
* Previously, `UrlbarView.onQueryResults` called UrlbarInput in order to
  autofill after the first result is received. This is circuitous becaue the
  input already has an `onFirstResult` method, which I now use to enter search
  mode when appropriate. So I moved the autofill call from UrlbarView to
  `UrlbarInput.onFirstResult`.
* As I mentioned, I improved some test framework and simplified some related
  product (non-test) code. For example:
    * I removed `UrlbarUtils.KEYWORD_OFFER.NONE` in favor of just leaving
      `keywordOffer` as `undefined`.
    * `tailOffsetIndex` can now be `undefined` if it's not relevant.
    * I removed empty-string `icon` properties from payloads in favor of
      `undefined`.
    * In tests, I ignore `undefined` but present properties in payloads so they
      don't count when comparing payloads with `deepEqual`.
    * We weren't previously comparing `result.source` and `result.type` in
      xpcshell tests, and that's important IMO, so I added checks for those and
      updated tests.
    * `isSearchHistory` is redundant, so I removed it. For form history, we
      should be checking `result.source == HISTORY` and `result.type == SEARCH`.
* A bunch of tests needed to be updated for this new behavior.

Differential Revision: https://phabricator.services.mozilla.com/D87944
2020-09-02 00:52:12 +00:00
Drew Willcoxon
392921ff50 Bug 1657918 - Don't add a heuristic result for empty searches in local search modes, and modify the view to allow it to stay open when empty. r=harry
This excludes the heuristic for empty searches when in search mode. I haven't
heard back from Verdi yet about excluding it for all searches in search mode. We
can add that in a follow-up if necessary.

Since we're now excluding the heuristic but we want the view to remain open,
it's possible for the view to be empty while it's open. I had to make some
changes to allow that to happen. There are three cases I want to call out:

1. When the search string is empty, the view shows top sites. If you then enter
   search mode and the resulting search doesn't return any results, we
   previously closed the view. This patch keeps it open. An example of this
   scenario is when you don't have any bookmarks and you click the bookmarks
   one-off.
2. When the urlbar isn't focused, it's in search mode, the input is empty, and
   the search didn't return any results, then focusing the urlbar didn't do
   anything previously. This patch auto-opens the view.
3. When the input contains a single char and it's in search mode, deleting the
   char previously closed the view if the empty search didn't return any
   results. This patch keeps the view open.

When the view is empty, we also need to hide the one-offs' top border that
usually separates them from the results. Otherwise there are two separator lines
right next to each other, the one above the one-offs and the one at the bottom
edge of the input. I don't think there's any CSS selector that will let us
easily do this due to the DOM structure, so I added a new `noresults` attribute
on the view for this.

I had to call `context.searchString.trim()` to tell whether the search string is
empty. Since we do that in a bunch of places, I added
`context.trimmedSearchString`, and a lot of this patch is replacing those `trim`
calls.

Differential Revision: https://phabricator.services.mozilla.com/D86908
2020-08-13 19:00:14 +00:00
Harry Twyford
28382708b4 Bug 1654801 - Part 3 - Fix tests to work with update2/oneOffsRefresh prefs enabled. r=adw
Differential Revision: https://phabricator.services.mozilla.com/D86767
2020-08-12 03:40:28 +00:00
Marco Bonardo
5aebedb024 Bug 1654862 - Tests. r=adw
Differential Revision: https://phabricator.services.mozilla.com/D86386
2020-08-08 21:07:39 +00:00
Marco Bonardo
0d2c4db450 Bug 1655693 - In case of score match, autofill should prefer https. r=adw
Differential Revision: https://phabricator.services.mozilla.com/D85183
2020-07-29 08:56:11 +00:00
Marco Bonardo
1180e54f66 Bug 1654316 - Autofill is not properly considering bookmarked status of origins. r=adw
The old query was picking a random bookmarked status out of the pages in an origin,
depending on the physical position of the origin rows in the table.
The new query uses window functions to partition the data by origin, so it can
query origins just once and sum www and non-www origin's frecency scores before
comparing to the autofill threshold.

Differential Revision: https://phabricator.services.mozilla.com/D84657
2020-07-24 12:01:15 +00:00
Harry Twyford
ccc05640a1 Bug 1648468 - Part 4 - Port autofill unit tests to browser/components/urlbar. r=adw
Differential Revision: https://phabricator.services.mozilla.com/D82237
2020-07-12 21:55:24 +00:00
Csoregi Natalia
a9213a383e Backed out 6 changesets (bug 1648468) for failures on test_keywords.js. CLOSED TREE
Backed out changeset 918db5010acb (bug 1648468)
Backed out changeset 91a4b5b593bf (bug 1648468)
Backed out changeset 3bded27be98e (bug 1648468)
Backed out changeset 60a36d4424df (bug 1648468)
Backed out changeset 1edf02398318 (bug 1648468)
Backed out changeset ebac9fb9da0d (bug 1648468)
2020-07-12 09:03:53 +03:00
Harry Twyford
3d5e6f200d Bug 1648468 - Part 4 - Port autofill unit tests to browser/components/urlbar. r=adw
Differential Revision: https://phabricator.services.mozilla.com/D82237
2020-07-11 22:53:09 +00:00
Razvan Maries
02567baa96 Backed out 6 changesets (bug 1648468) for perma failures on browser_test_focus_urlbar.js. CLOSED TREE
Backed out changeset 60b6915e8037 (bug 1648468)
Backed out changeset fc7a6b8f84a2 (bug 1648468)
Backed out changeset 97c7475abf85 (bug 1648468)
Backed out changeset bb37a0821844 (bug 1648468)
Backed out changeset 10447a3e04ff (bug 1648468)
Backed out changeset 69a210ce0e9a (bug 1648468)
2020-07-12 01:31:42 +03:00
Harry Twyford
de61dd9c87 Bug 1648468 - Part 4 - Port autofill unit tests to browser/components/urlbar. r=adw
Differential Revision: https://phabricator.services.mozilla.com/D82237
2020-07-11 06:43:52 +00:00
Mark Banner
7ce8343947 Bug 1632448 - Remove now unused confirm and extensionID parameters for nsISearchService.addEngine, and rename it. r=daleharvey
Renaming to addOpenSearchEngine to make it more explicit about what it is actually doing.

Depends on D82524

Differential Revision: https://phabricator.services.mozilla.com/D82525
2020-07-09 09:56:25 +00:00
Drew Willcoxon
22a1e1d317 Bug 1640045 - Replace PlacesSearchAutocompleteProvider with UrlbarSearchUtils, remove its parseSubmissionURL function, and init the search service on the first query. r=mak
* Replace PlacesSearchAutocompleteProvider with UrlbarSearchUtils.
  * Move the module from toolkit to browser. The only consumers of
    PlacesSearchAutocompleteProvider are urlbar and UnifiedComplete.
  * I'd like to add functions to UrlbarUtils instead, but
    PlacesSearchAutocompleteProvider adds itself as an observer for search
    engine changes, and it keeps some state so that alias lookups are O(1). It
    has an init function to set that up. That's not quite as easy to do if I
    just added some functions to UrlbarUtils, and I think that O(1) lookups of
    aliases are worth keeping (vs. O(number of installed engines)), so I kept a
    separate module, now called UrlbarSearchUtils.
* Init the search service (via UrlbarSearchUtils) from
  UrlbarProvidersManager.startQuery so that every module involved in querying
  doesn't need to do it.
* Remove PlacesSearchAutocompleteProvider.currentEngine. Previous consumers can
  simply use Services.search directly now that the service is initialized early
  (see previous point).
* Remove PlacesSearchAutocompleteProvider.parseSubmissionURL. Here again
  consumers can use Services.search directly.

Differential Revision: https://phabricator.services.mozilla.com/D79244
2020-06-16 01:08:38 +00:00
Harry Twyford
bb8e608bf2 Bug 1642710 - Split UrlbarProviderOmnibox out from UnifiedComplete r=adw
Differential Revision: https://phabricator.services.mozilla.com/D78846
2020-06-11 17:12:52 +00:00
Drew Willcoxon
03881f56fa Bug 1398416 - Part 3: Implement form history results. r=mak
Differential Revision: https://phabricator.services.mozilla.com/D75685
2020-05-21 19:31:27 +00:00
Harry Twyford
58cfeff038 Bug 1626891 - Style tail suggestions differently. r=mak
Differential Revision: https://phabricator.services.mozilla.com/D74740
2020-05-19 13:57:54 +00:00
Harry Twyford
cb337c4820 Bug 1626897 - Part 4 - Add tail suggestion tests. r=mak
Differential Revision: https://phabricator.services.mozilla.com/D74120
2020-05-12 17:01:19 +00:00
Drew Willcoxon
1059a8c575 Bug 1398416 - Part 2: Rewrite Muxer.sort() to wait for the heuristic result and to be more efficient, in preparation for form history changes. r=mak
By returning false (or not adding results to `context.results`), the muxer
signals that it needs more results in order to decide how to sort them and to
sort them without flickering. After the providers manager calls each provider's
`startQuery`, it removes the provider from `context.activeProviders` and calls
`_notifyResultsFromProvider` one more time so that the muxer can resort if
necessary given the new `context.activeProviders`.

We can also be a little faster and more efficient by making only two passes over
the results, and by keeping a `context.heuristicResult` property that's updated
by the providers manager.

This also fixes a bug with the search suggestions provider, where it didn't
include a suggestion that matched the user's search string even if the heuristic
result was not a search result (e.g., if it's an autofill). That deduping logic
should be done in the muxer.

Finally this removes browser_restyleSearches.js since the muxer changes removed
part of the restyling functionality. I'll file a follow-up to remove other parts
of restyling.

Differential Revision: https://phabricator.services.mozilla.com/D74192
2020-05-11 23:03:09 +00:00
Harry Twyford
c2c94fda74 Bug 1626946 - Remove search suggestions that dupe a search history result. r=adw
Differential Revision: https://phabricator.services.mozilla.com/D71094
2020-04-22 17:41:00 +00:00
Harry Twyford
c5aa700ae0 Bug 1623637 - Part 6 - Port part of search_suggestions_aliases.js. r=mak
Differential Revision: https://phabricator.services.mozilla.com/D69701
2020-04-07 20:30:33 +00:00
Harry Twyford
c9e8103c92 Bug 1623637 - Part 5 - Port test_search_suggestions.js. r=mak
Differential Revision: https://phabricator.services.mozilla.com/D69700
2020-04-07 20:30:25 +00:00
Marco Bonardo
6c919d7e92 Bug 1619290 - Remove urlbar tests dependency from Places head-common.js. r=harry
Differential Revision: https://phabricator.services.mozilla.com/D64969
2020-03-02 16:31:07 +00:00
Drew Willcoxon
ceed5d9027 Bug 1611055 - Replace UrlbarProvider subclasses in tests with UrlbarTestUtils.TestProvider. r=harry
Differential Revision: https://phabricator.services.mozilla.com/D61253
2020-01-30 18:08:51 +00:00
Drew Willcoxon
d3e9856501 Bug 1608597 - Quantumbar: Replace restricting providers with a priority system. r=mak
Replace `isRestricting` with `getPriority` -- i.e., replace the binary restricting system with a general priority system. Instead of choosing restricting providers, the providers manager chooses the highest-priority providers.

Differential Revision: https://phabricator.services.mozilla.com/D60093
2020-01-17 20:50:45 +00:00
Mark Banner
78012359ea Bug 1609937 - Get test_UrlbarQueryContext_restrictSource.js working with the search modern configuration. r=mak
Differential Revision: https://phabricator.services.mozilla.com/D60247
2020-01-17 17:50:59 +00:00
Cosmin Sabou
e9fcd0f800 Backed out changeset c516b5d716f1 (bug 1608597) for browser chrome failures on browser_search_tips. 2020-01-17 20:10:21 +02:00
Drew Willcoxon
a5f48fa02d Bug 1608597 - Quantumbar: Replace restricting providers with a priority system. r=mak
Replace `isRestricting` with `getPriority` -- i.e., replace the binary restricting system with a general priority system. Instead of choosing restricting providers, the providers manager chooses the highest-priority providers.

Differential Revision: https://phabricator.services.mozilla.com/D60093
2020-01-17 16:11:31 +00:00
Marco Bonardo
6e35555d2e Bug 1603393 - Perma failure in test_UrlbarQueryContext_restrictSource.js when merging to beta. r=Standard8
Differential Revision: https://phabricator.services.mozilla.com/D56953
2019-12-13 15:27:56 +00:00
Marco Bonardo
f7ea4ebc20 Bug 1599840 - part 2 - Set restricting behavior based on QueryContext sources. r=adw
Differential Revision: https://phabricator.services.mozilla.com/D56354
2019-12-11 16:52:09 +00:00
Drew Willcoxon
411091c60b Bug 1597610 - Add browser.urlbar.onEngagement WebExtensions API. r=mak,mixedpuppy
Adds a `browser.urlbar.onEngagement` event. Listeners are passed the current engagement state: start, engagement, abandonment, or discard. The extension could use this to record its own parallel telemetry (scalars, event telemetry, etc.) per engagement.

Differential Revision: https://phabricator.services.mozilla.com/D53897
2019-11-25 23:52:56 +00:00
Harry Twyford
e58fba1911 Bug 1582339 - Let tip results hide the help button and remove the details object from onResultPicked. r=adw
Differential Revision: https://phabricator.services.mozilla.com/D49779
2019-10-23 15:26:08 +00:00
Drew Willcoxon
a08ef6e3f5 Bug 1578584 - Quantumbar WebExt API: Add onResultPicked event. r=harry,mixedpuppy
Adds a new event listener to `browser.urlbar` called `onResultPicked`. This event is fired for tip results when they don't specify a URL. Hypothetically it could be fired for any type of result that didn't specify a URL, but that's only tips for now.

The listener is passed two arguments: the payload of the result that was picked, and a "details" object whose properties depend on the type of result. For tips, details is `{ helpPicked }`, where `helpPicked` is true if the help button was picked and false if the main button was picked.

Differential Revision: https://phabricator.services.mozilla.com/D46254
2019-09-26 13:53:14 +00:00
Brindusan Cristian
fa58466122 Backed out 2 changesets (bug 1556789) on request from aryx for causing Bug 1565836. a=backout
Backed out changeset ca5fdf3a0ddd (bug 1556789)
Backed out changeset 19419ff4e756 (bug 1556789)
2019-07-13 20:52:45 +03:00
Shane Caraveo
d24d4ba91c Bug 1556789 - Refactor extension install in searchservice to use promises r=robwu,daleharvey
This provides a set of promises that the searchservice resolves once the search engine has been configured

Differential Revision: https://phabricator.services.mozilla.com/D33660
2019-07-12 19:33:32 +00:00
Gurzau Raul
719f78a402 Backed out 2 changesets (bug 1556789) for assertion failures in FF functional tests on a CLOSED TREE.
Backed out changeset 2d10e95cf0cd (bug 1556789)
Backed out changeset 0acf6bafda0f (bug 1556789)
2019-07-12 04:45:46 +03:00
Shane Caraveo
5e55c6af34 Bug 1556789 - Refactor extension install in searchservice to use promises r=robwu,daleharvey
This provides a set of promises that the searchservice resolves once the search engine has been configured

Differential Revision: https://phabricator.services.mozilla.com/D33660
2019-07-11 18:42:00 +00:00