Commit Graph

131 Commits

Author SHA1 Message Date
Drew Willcoxon
247ce81e9b Bug 1915317 - Integrate Rust exposure suggestions with desktop. r=daisuke
This integrates Rust exposure suggestions with desktop. Exposure suggestions are
a part of the replacement for the existing potential exposures feature
(bug 1881875). When we want to test potential exposures in the future, we can
add new exposure suggestions to remote settings and tell the Rust component to
ingest them and return them in queries. When the Rust component returns an
exposure suggestion, desktop will record it in exposure telemetry. (The other
part of the replacement is keyword exposure telemetry in bug 1915507 D220501).

More details about the design of exposure suggestions here:

* Bug 1893086
* https://github.com/mozilla/application-services/pull/6343

The way desktop tells the Rust component about different types of exposure
suggestions is through the new "provider constraints" feature. `ingest()` and
`query()` can take a `SuggestionProviderConstraints` object that changes what's
ingested and queried. Therefore, we need to re-ingest exposure suggestions when
the provider constraints change. Right now, exposure suggestions are the only
kind of suggestions that use provider constraints.

Depends on D220359

Differential Revision: https://phabricator.services.mozilla.com/D220359
2024-09-06 04:30:20 +00:00
Drew Willcoxon
f3302e8ef0 Bug 1914545 - Make UrlbarProviderQuickSuggest add all its suggestions instead of only the first. r=mak
Please see the bug for details.

This makes some changes to search strings and URLs in the tests that might look
unnecessary. They're due to switching to the QuickSuggestTestUtils helpers in
the head files instead of hardcoding the suggestions data. It's possible to
force the helpers to use the existing search strings and URLs that are used in
these tests, but it's good to be consistent with other tests that use these
helpers because it makes everything easier to understand.

Depends on D220352

Differential Revision: https://phabricator.services.mozilla.com/D219943
2024-09-06 04:30:20 +00:00
Norisz Fay
df377f83f3 Backed out changeset 76f7599ecbfa (bug 1914545) as requested by developer for causing Bug 1916458 CLOSED TREE 2024-09-03 23:23:42 +03:00
Drew Willcoxon
bc60fd377d Bug 1914545 - Make UrlbarProviderQuickSuggest add all its suggestions instead of only the first. r=mak
Please see the bug for details.

This makes some changes to search strings and URLs in the tests that might look
unnecessary. They're due to switching to the QuickSuggestTestUtils helpers in
the head files instead of hardcoding the suggestions data. It's possible to
force the helpers to use the existing search strings and URLs that are used in
these tests, but it's good to be consistent with other tests that use these
helpers because it makes everything easier to understand.

Depends on D219942

Differential Revision: https://phabricator.services.mozilla.com/D219943
2024-08-27 20:12:55 +00:00
Drew Willcoxon
eeabfdc62a Bug 1913507 - Add capability to show AMP suggestions as top picks based on keyword character counts. r=daisuke,fluent-reviewers,flod
Depends on D219369

Differential Revision: https://phabricator.services.mozilla.com/D219370
2024-08-20 05:57:40 +00:00
Drew Willcoxon
ccf7a3d409 Bug 1912565 - Show sponsored suggestions at the bottom of the Firefox Suggest section when search suggestions are disabled or the default engine doesn't support them. r=daisuke
Differential Revision: https://phabricator.services.mozilla.com/D219369
2024-08-20 01:12:50 +00:00
Drew Willcoxon
631061e66c Bug 1897244 - Convert the QuickSuggest provider onLegacyEngagement to use the new notifications. r=daisuke
Differential Revision: https://phabricator.services.mozilla.com/D218439
2024-08-05 17:08:40 +00:00
Drew Willcoxon
a6578c7679 Bug 1907990 - Implement urlbar.fakespot_engagement event. r=daisuke
This implements the [spec here](https://docs.google.com/document/d/12QWXvi8cIAo9AaGgwzP5a7Mcs9CsffWQ_XlAi6WqjX8/edit?usp=sharing) as I discussed with Teon. I chose slightly
different names for the extra keys to be consistent with the RS data and urlbar
implementation.

Differential Revision: https://phabricator.services.mozilla.com/D217046
2024-07-19 02:48:54 +00:00
Daisuke Akatsuka
79d71c7bd4 Bug 1906017 - Display Sponsored Suggestions at the bottom if browser.urlbar.showSearchSuggestionsFirst is false r=adw
Depends on D215709

Differential Revision: https://phabricator.services.mozilla.com/D215581
2024-07-08 23:45:12 +00:00
Daisuke Akatsuka
da00b8a3de Bug 1891602: Remove telemetries that are no longer in use r=adw
Differential Revision: https://phabricator.services.mozilla.com/D207514
2024-04-17 08:54:56 +00:00
Daisuke Akatsuka
a12822f81a Bug 1891602: Use manage menu item for general quick suggestion r=adw
Differential Revision: https://phabricator.services.mozilla.com/D207513
2024-04-17 08:54:56 +00:00
Karandeep
d8690f18b5 Bug 1888908 - Rename current onEngagement to onLegacyEngagement r=mak
Differential Revision: https://phabricator.services.mozilla.com/D206251
2024-04-09 13:07:23 +00:00
Karandeep
d36112e266 Bug 1888905 - Remove the start and discard notifications. r=mak,adw
Differential Revision: https://phabricator.services.mozilla.com/D206238
2024-04-05 16:15:08 +00:00
Norisz Fay
f8ee70f7ac Backed out changeset 519aa7ff2ca6 (bug 1888905) for causing bc failures on browser_glean_telemetry_reenter.js CLOSED TREE 2024-04-04 18:37:26 +03:00
Karandeep
059ef5ae44 Bug 1888905 - Remove the start and discard notifications. r=mak,adw
Differential Revision: https://phabricator.services.mozilla.com/D206238
2024-04-04 14:06:23 +00:00
Drew Willcoxon
236d5ce7eb Bug 1883807 - Enforce a two-character threshold for Suggest matches. r=daisuke
Differential Revision: https://phabricator.services.mozilla.com/D203704
2024-03-06 04:58:04 +00:00
Cristian Tuns
4524da1c31 Backed out changeset 488c772c7274 (bug 1883807) for causing bc failures in browser_quicksuggest_onboardingDialog.js CLOSED TREE 2024-03-05 23:33:37 -05:00
Drew Willcoxon
aa9992aa0f Bug 1883807 - Enforce a two-character threshold for Suggest matches. r=daisuke
Differential Revision: https://phabricator.services.mozilla.com/D203704
2024-03-06 02:50:40 +00:00
Dave Townsend
35b9a307e5 Bug 1864896: Remove jsdoc params for removed arguments (browser/components/urlbar). r=mak
Differential Revision: https://phabricator.services.mozilla.com/D202955
2024-03-03 09:09:10 +00:00
Dave Townsend
98ed146e46 Bug 1864896: Autofix unused function arguments (browser/components/urlbar). r=mak
Differential Revision: https://phabricator.services.mozilla.com/D202954
2024-03-03 09:09:09 +00:00
Daisuke Akatsuka
bd9654a173 Bug 1881071: Stop suggest if the query length is less than length of when clicking 'Show less frequently' r=adw
Differential Revision: https://phabricator.services.mozilla.com/D202773
2024-02-27 06:46:22 +00:00
Dale Harvey
a6bc2baf74 Bug 1841762 - Ensure onEngagement has queryContext defined. r=mak
Differential Revision: https://phabricator.services.mozilla.com/D197265
2024-01-18 17:52:58 +00:00
Chris H-C
460ebb882a Bug 1868580 - Remove PingCentre from Contextual Services r=nanj,perry.mcmanis
As of 11amPT December 7, Contextual Services is now looking exclusively at
Glean-sent data for Firefox versions 116+. (See DSRE-1489)

Differential Revision: https://phabricator.services.mozilla.com/D195910
2023-12-11 19:21:37 +00:00
Perry McManis
d4d8f5865d Bug 1862660 - Prevent setting of empty strings in quick suggest pings r=chutten,adw
Differential Revision: https://phabricator.services.mozilla.com/D192707
2023-11-29 20:50:52 +00:00
Drew Willcoxon
f8ae0421dd Bug 1859389 - Modify desktop Suggest integration so it properly handles timestamp templates. r=daisuke
This makes sure `result.payload.originalUrl` is set correctly depending on Rust
vs. JS, and AMP vs. Wikipedia. The logic is getting a little messy due to all
the various combinations, but there's no way around it until we drop the JS
backend.

I tried setting `raw_url` (or `rawUrl`) on JS suggestions to match Rust
suggestions, and while that made the `AdmWikipedia` logic slightly nicer, it
either made the `UrlbarProviderQuickSuggest._canAddSuggestion()` logic a little
uglier because we need to also check `raw_url` for JS suggestions (snake_case),
or instead we could set `rawUrl` (camelCase) on JS suggestions just like Rust
suggestions, but every other property on JS suggestions uses snake_case.

This is *not* based on bug 1861540 because we need to uplift this, but I don't
want to uplift bug 1861540.

Differential Revision: https://phabricator.services.mozilla.com/D192124
2023-10-30 22:04:56 +00:00
Drew Willcoxon
e47b4dcd5b Bug 1858553 - Remove the merinoEnabled Nimbus variable and fallback pref. r=daisuke
Depends on D190745

Differential Revision: https://phabricator.services.mozilla.com/D190746
2023-10-12 15:50:50 +00:00
Drew Willcoxon
57b0f17880 Bug 1858549 - Remove the quickSuggestRemoteSettingsEnabled Nimbus variable and fallback pref. r=daisuke
Depends on D190742

Differential Revision: https://phabricator.services.mozilla.com/D190745
2023-10-12 15:50:50 +00:00
Drew Willcoxon
234916db20 Bug 1857391 - Remove Firefox Suggest "best match" as its own separate feature. r=daisuke,settings-reviewers
This removes "best match" as its own separate Firefox Suggest feature. In the
future, whether or not a suggestion is a best match (a.k.a. top pick) will be
determined by relevant product requirements. I've confirmed this with Nive.

Here's a summary of changes:

* Removes prefs and Nimbus variables related to best match
* Removes the "Top pick" checkbox in about:preferences
* Removes support for the `best_match` quick suggest config property. This
  property was removed from the config in remote settings a while ago.
* Removes legacy telemetry scalars related to best match. These scalars were
  added years ago for the original best match experiment and before we started
  using Glean. In the case of non-sponsored suggestions, the scalars have not
  been recorded at all for some time. In the case of sponsored suggestions, they
  can now be recorded again due to the recent addition of sponsored priority
  suggestions, but they are superseded by Glean.

Differential Revision: https://phabricator.services.mozilla.com/D190516
2023-10-11 17:17:06 +00:00
Drew Willcoxon
0d60a186b7 Bug 1855884 - Handle icons from the Suggest Rust component. r=dao
The new Rust implementation of Suggest stores icons for some suggestion types in
its Sqlite database, and it returns these icons to consumers as byte arrays. To
show these icons in the view quickly and without any overhead, we can create
`Blob` URLs from the arrays. Blob URLs need to be revoked when we're done with
them to avoid leaking the backing data.

This patch implements some simple lifetime management of blob URLs in the view.
The first time the view shows a result, it creates a blob URL for the result's
icon. The view caches the URL while it remains open, so as the user continues to
type and possibly match the same result many times, the view will use the same
blob URL each time. When the view closes, it revokes the URL. This seems like a
reasonable, natural lifetime for these URLs, and the implementation is simple.

Depends on D189452

Differential Revision: https://phabricator.services.mozilla.com/D189615
2023-10-05 04:36:12 +00:00
Drew Willcoxon
29454d2d80 Bug 1855615 - Make sure Suggest Glean telemetry is tested with the Rust backend enabled. r=daisuke
This updates the engagement Glean test so it checks Rust results.

It also adds a getter to `SuggestBackendRust` that returns a promise that's
resolved once the backend's initialization is fully complete. Setting
`quicksuggest.rustEnabled` will either trigger the Rust backend to perform
initialization and ingestion, or it will trigger the JS backend to re-sync all
features. Either way, tests need to wait until all of that is done.

Differential Revision: https://phabricator.services.mozilla.com/D189452
2023-09-29 01:02:33 +00:00
Drew Willcoxon
336e2ba93f Bug 1854060 - Initial integration of the Suggest Rust component into desktop urlbar. r=daisuke
This builds on D188681 and adds a new `BaseFeature` called `SuggestBackendRust`.
When `quickSuggestRustEnabled` is true, `UrlbarProviderQuickSuggest` will use
`SuggestBackendRust` to fetch remote settings suggestions; otherwise it will use
`SuggestBackendJs`.

The Rust component is already integrated into desktop Firefox (bug 1851256, bug
1851845), and it's exposed to JS via `RustSuggest.sys.mjs`. Currently it only
supports AMP (sponsored, a.k.a. adM) and Wikipedia (non-sponsored) suggestions.

It's possible to configure the path of the Sqlite file created by the Rust
component. This patch uses `suggest.sqlite` in the user's local profile (cache)
directory.

This is only the initial integration. I can think of a few follow-ups:

* Handle icons. In this patch, results from `SuggestBackendRust` don't have
  icons at all. I have a WIP.
* Handle ingestion better. "Ingest" here means Firefox must tell the Rust
  component to re-fetch suggestions from remote settings and rebuild its Sqlite
  database. Unfortunately the Rust component doesn't keep the data updated by
  itself, so we'll need to periodically tell the component to ingest. This patch
  performs ingestion every time `SuggestBackendRust` is (re)enabled, which is a
  good enough start.
* Maybe handle tests better. For now I modified the main quick suggest unit
  test, test_quicksuggest.js, so it tests both backends. Other tests should
  maybe be updated too, I'm not sure yet.

Depends on D188681

Differential Revision: https://phabricator.services.mozilla.com/D188684
2023-09-26 05:15:30 +00:00
Drew Willcoxon
f5ec50f5ae Bug 1854059 - Convert Suggest remote settings component to a BaseFeature. r=daisuke
This converts `QuickSuggestRemoteSettings` into a `BaseFeature` so that it can
be managed by `QuickSuggest` and easily enabled and disabled depending on
whether the new Rust component is enabled.

Summary of major changes:

* Rename `QuickSuggestRemoteSettings` to `SuggestBackendJs` and make it a
  `BaseFeature`. In D188684 I'll also add a new `SuggestBackendRust` feature.
* Introduce a `quickSuggestRustEnabled` Nimbus variable. The JS backend will be
  disabled if this variable is true. Nothing else uses the variable in this
  patch but D188684 does.
* Move `DEFAULT_SUGGESTION_SCORE` to `UrlbarProviderQuickSuggest` and make the
  provider ensure all suggestions have scores.

Differential Revision: https://phabricator.services.mozilla.com/D188681
2023-09-26 05:15:29 +00:00
Drew Willcoxon
c82e8b55f0 Bug 1854755 - Add suggested_index and suggested_index_relative_to_group to Suggest pings. r=nanj
This adds two new fields to the Suggest PingCentre and Glean pings:

* `suggested_index` -
  An integer value that is the intended index of the suggestion
  being interacted with. If `suggested_index_relative_to_group` is true, the
  index is relative to the "Firefox Suggest" group; otherwise the index is
  relative to the entire list of suggestions. Non-negative values (starting
  at 0) are relative to the start/top of the group/list; negative values are
  relative to the end/bottom of the group/list.
* `suggested_index_relative_to_group` -
  Whether `suggested_index` is relative to the "Firefox Suggest" group. If
  false, it is relative to the entire list of suggestions.

In the Glean ping, `suggested_index` is stringified because there's no integer
metric type that can take negative numbers.

These two values reflect how the implementation works and will let us record any
indexes we want to experiment with. Suggestions are usually shown at the bottom
of the Firefox Suggest group, and in that case these values will be:

```
suggested_index = -1
suggested_index_relative_to_group = true
```

If we want to show suggestions at the top of the Firefox Suggest group instead
of the bottom, the values will be:

```
suggested_index = 0
suggested_index_relative_to_group = true
```

Differential Revision: https://phabricator.services.mozilla.com/D189035
2023-09-26 02:48:30 +00:00
Daisuke Akatsuka
fe247c61cb Bug 1852187: Move sponsored suggestions higher r=adw,fluent-reviewers,flod
Differential Revision: https://phabricator.services.mozilla.com/D187873
2023-09-14 05:14:48 +00:00
Gregory Pappas
e9950eccfd Bug 1845311 - Use ChromeUtils.defineLazyGetter in more places r=arai,webdriver-reviewers,geckoview-reviewers,extension-reviewers,application-update-reviewers,credential-management-reviewers,devtools-reviewers,fxview-reviewers,anti-tracking-reviewers,sessionstore-reviewers,pbz,joschmidt,robwu,issammani,bytesized,owlish,dao
Differential Revision: https://phabricator.services.mozilla.com/D184481
2023-07-26 16:28:11 +00:00
Marco Bonardo
b99e0f7f7e Bug 1827770 - Remove isPrivate argument from onEngagement() since it can be inferred. r=daleharvey
We can't use context.isPrivate because sometimes context is undefined.
I filed https://bugzilla.mozilla.org/show_bug.cgi?id=1841762 about that.

Differential Revision: https://phabricator.services.mozilla.com/D182772
2023-07-07 10:01:50 +00:00
Marco Bonardo
ff3c4323fc Bug 1827770 - Remove QueryContext.view and pass the controller to onEngagement() instead. r=daleharvey
Differential Revision: https://phabricator.services.mozilla.com/D182771
2023-07-07 10:01:50 +00:00
Drew Willcoxon
bf1430c569 Bug 1841408 - Unify rich suggestions, best match, Firefox Suggest sponsored results, and Pocket Suggestions. r=dao,daleharvey
This does a few things:

* Unify the view implementations of rich suggestions, Firefox Suggest sponsored
  results, and best match. I did this by using the best match implementation
  and extending it to rich suggestions and Suggest sponsored.
* Use the unified implementation for Pocket suggestions too.
* Add a bottom-text concept since Pocket suggestions shown as top picks need to
  show both a description and some text below it. (The actual bottom text per
  result is added in D182632 since I didn't want to make this patch bigger than
  necessary)

I have a couple motivations for these changes:

* I'm implementing Pocket suggestions, which need to show some text below the
  suggestion title as well as the URL. I was going to just use the Firefox
  Suggest sponsored approach, where the action text is wrapped below the title,
  but that doesn't work because it can't show both the wrapped action text and
  the URL.
* IMO we should use rich suggestions as the basis for all rows going forward,
  i.e., unify the different row implementations around rich suggestions.

The reason I chose the best match implementation instead of the rich suggestions
implementation is because the grid-based approach of rich suggestions doesn't
work well when the URL also needs to be shown. The URL should be
baseline-aligned with the row title, which isn't easy to do when the URL is
outside the grid. The rich suggestions implementation also doesn't wrap the URL.

Other details:

* The `rich-suggestion=no-icon` attribute value is only used for styling, so we
  can replace it with `@supports -moz-bool-pref()`. That lets us make the
  `rich-suggestion` attribute a simple boolean.
* I kept the `isBestMatch` property for results since
  `searchEngagementTelemetryGroup()` uses it to return "top_pick", and the view
  also uses it to create the "Top pick" row/group label. It still has semantic
  meaning so I think that's OK. It's no longer used by the view to create
  different DOM or styling.
* Move `isRichSuggestion` from the payload to the result itself, since it's no
  longer used for only one type of result. It's like `isBestMatch`, which is
  also on the result.
* Add `richSuggestionIconSize` to the result too. The best match icon size
  is 52. The Pocket best match icon size is 24 (but will have added padding and
  a background color to make it appear 52px). IMO this is better than adding
  rules for each type of suggestion to the CSS. It's cleaner and also indicates
  what the "standard" icon sizes are.

Depends on D182580

Differential Revision: https://phabricator.services.mozilla.com/D182537
2023-07-05 15:47:24 +00:00
Chris H-C
eca601ffd9 Bug 1836283 - Reinstrument contextual services PingCentre pings in parallel with Glean r=perry.mcmanis,nanj,wstuckey
Covers topsites and quicksuggest impressions, clicks, and blocks.

Removes unused and not-to-be-used topsites-in-urlbar pingcentre instrumentation
rather than reinstrumenting it.

Differential Revision: https://phabricator.services.mozilla.com/D179856
2023-06-26 19:02:46 +00:00
Drew Willcoxon
bd2145522d Bug 1839558 - Allow suggestion scores to be specified in Nimbus. r=daisuke
This adds a `quickSuggestScoreMap` Nimbus variable that lets experiments
override suggestion scores. It maps from telemetry types to score values. For
example:

```
"quickSuggestScoreMap": {
  "amo": 0.25,
  "adm_sponsored": 0.3
}
```

In this example, addon suggestions will always have a score of 0.25, and
sponsored suggestions will always have a score of 0.3. Of course, different
branches within an experiment and different experiments can set different
scores.

While working on this, I saw we have a bug when we try to look up the
`BaseFeature` for a result. To do the lookup, we look up the result's
`telemetryType` in `FEATURE_NAMES_BY_TELEMETRY_TYPE`. That's a problem for `adm`
suggestions because the `telemetryType` will be either `adm_sponsored` or
`adm_nonsponsored`, but neither of those is present in
`FEATURE_NAMES_BY_TELEMETRY_TYPE` -- only `adm` is.

To fix it, I added back the `provider` property to result payloads that I
previously removed, and I added `BaseFeature.merinoProvider` so each feature can
specify its Merino provider. Then, `QuickSuggest` can build a map from Merino
provider names to features, allowing us to look up features without needing to
hardcode something like `FEATURE_NAMES_BY_TELEMETRY_TYPE` or
`FEATURE_NAMES_BY_MERINO_PROVIDER`.

Since I added back the `provider` property, I had to update a lot of tests. (As
a follow up, it would be nice to centralize the creation of expected result
objects in the test helper.)

I also added `BaseFeature.getSuggestionTelemetryType()` to help implement the
score map and to better formalize the idea that telemetry types are an important
property that all quick suggest results should include.

Differential Revision: https://phabricator.services.mozilla.com/D181709
2023-06-22 03:55:40 +00:00
Drew Willcoxon
3fd234d2a0 Bug 1836903 - Implement Pocket suggestions. r=daisuke,desktop-theme-reviewers,dao
This implements most parts of Pocket suggestions. They don't need any special UI
or a dynamic result type because they're only shown as the usual best match rows
or non-best match rows.

Still to do:

* Implement the "Show less frequently" behavior once we decide what the keywords
  will be and how that will work.
* Implement the bottom "Mozilla Pocket" text inside the suggestion row once it's
  finalized. We can use the same technique we use to show the "Sponsored" bottom
  text for adM suggestions.

Other changes this makes:

* Replace the `type=bestmatch` attribute with an `bestmatch` attribute. That
  lets best-match rows have a `type` too, in this case `"pocket"` (actually
  either `"rs_pocket"` or `"merino_pocket"`, since I'm using the telemetry
  result type).
* Improve how UrlbarProviderQuickSuggest delegates to individual features when
  getting result commands, view updates, handling commands, etc., so that we
  don't need to add new `case` statements for each new type of suggestion.

Differential Revision: https://phabricator.services.mozilla.com/D180059
2023-06-07 20:19:44 +00:00
Daisuke Akatsuka
13d726e71a Bug 1833760: Integrate remote settings suggestions with AddonSuggestions r=adw
Differential Revision: https://phabricator.services.mozilla.com/D178424
2023-05-22 01:20:56 +00:00
Daisuke Akatsuka
db3c5fdf57 Bug 1833515: Hide suggestions for addons the user has installed r=adw
Differential Revision: https://phabricator.services.mozilla.com/D178263
2023-05-17 06:21:39 +00:00
Drew Willcoxon
21b13c63b8 Bug 1832927 - Move sponsored/nonsponsored checks back to UrlbarProviderQuickSuggest. r=daisuke
Please see bug 1832927 for background. This fixes the problem on 115 by moving
the sponsored/nonsponsored logic back to the provider.

I added a task to test_quicksuggest_topPicks.js, and I created xpcshell tests
for addons and dynamic Wikipedia with similar tasks. It would be nice to unify
this check for all quick suggest types somehow -- maybe a task in
test_quicksuggest.js, but that's not quite as simple as it seems because each
suggestion type has its own suggestion object and expected result payload. We
might also want to add more tasks to these new files. We can think about that
later because there are other opportunities for test consolidation too.

Differential Revision: https://phabricator.services.mozilla.com/D177952
2023-05-16 01:17:06 +00:00
Daisuke Akatsuka
ecbdc5d8f5 Bug 1832474: Implement addon suggestions result menu r=adw,fluent-reviewers,flod
Differential Revision: https://phabricator.services.mozilla.com/D177852
2023-05-15 12:25:06 +00:00
Drew Willcoxon
e6de21f076 Bug 1832300 - Show is_top_pick suggestions as top picks only when the best match prefs are enabled. r=daisuke
This keeps the current behavior where Firefox shows a suggestion as a top pick
when `is_top_pick` is true, but in addition the two best-match prefs must also
be true.

I cp'ed test_quicksuggest_bestMatch.js to test_quicksuggest_topPicks.js so that
we have a test specifically for top picks, and I added tasks for all preference
combinations. The terms "best match" and "top picks" are overloaded and I tried
to explain what they mean in the code comments I added.

Depends on  D176114

Differential Revision: https://phabricator.services.mozilla.com/D177712
2023-05-11 04:14:40 +00:00
Daisuke Akatsuka
45268fa4c7 Bug 1828610: Implement addon suggestions r=desktop-theme-reviewers,adw,fluent-reviewers,flod,dao
Differential Revision: https://phabricator.services.mozilla.com/D176114
2023-05-10 20:04:38 +00:00
Drew Willcoxon
94f4f34eee Bug 1831656 - Refactor quick suggest remote settings management. r=daisuke
This refactors quick suggest remote settings management so it will be easier to
support new types of remote settings suggestions. It builds on D177191.

Currently, RemoteSettingsClient only handles adM and Wikipedia suggestions. It
would be possible for it to support more suggestions types by adding a series of
`if` statements, one per suggestion type (to check if the suggestion type is
enabled), with each statement fetching a specific suggestion type's data.
However, that doesn't scale elegantly.

It would also be possible for RemoteSettingsClient to be agnostic about the
suggestions in remote settings. IOW it doesn't need to care that different types
of suggestions are stored in RS. It could treat them all as one big map from
keywords to suggestions. However, that would require uniformity and stability in
how suggestions are stored in RS, and since the Suggest project is not mature,
that's not the case right now, and it won't be the case any time soon.

Instead, this revision moves suggestion-specific logic from RemoteSettingsClient
to BaseFeature classes specific to each suggestion type. Each BaseFeature
registers itself with remote settings using the new QuickSuggestRemoteSettings
module, fetches its specific RS data, and builds whatever data structure is
appropriate for serving its suggestions. I expect most features to use a simple
map from keywords to suggestions, like adM/Wikipedia does, so I factored out the
map-related code into a new SuggestionsMap class. The weather feature is an
exception because only its keywords are stored in RS, not the suggestion itself.

UrlbarProviderQuickSuggest accesses remote settings suggestions by going through
QuickSuggestRemoteSettings. It only needs to make one call.

This design should work well when the cross-platform Rust component is ready.
We should only need to modify UrlbarProviderQuickSuggest so it fetches
suggestions from the Rust component instead of QuickSuggestRemoteSettings.

Depends on D177191

Differential Revision: https://phabricator.services.mozilla.com/D176779
2023-05-08 09:08:42 +00:00
Drew Willcoxon
7bcb27e930 Bug 1829081 - Make improvements to UrlbarProviderQuickSuggest in preparation for handling many types of suggestions. r=daisuke
This makes some changes to UrlbarProviderQuickSuggest that are much more modest
than my previously proposed refactorings in D176111 and D175998. After thinking
about it more and discussing it with @wstuckey and @daisuke, I'm not sure it's a
good idea to split UrlbarProviderQuickSuggest into multiple providers. In the
future, we will replace a lot of our desktop JS with a single cross-platform
Rust component that serves remote settings suggestions and possibly Merino
suggestions too. We should work with that in mind, and I don't think it makes a
lot of sense to have multiple urlbar providers all fetching from this one
component, even though it would make some things nicer, like being able to
isolate suggestion-specific UI code to each provider.

The main goal of this revision is to better prepare UrlbarProviderQuickSuggest
for many new types of suggestions:

* Add `#makeResult()`, which returns a new `UrlbarResult` appropriate for a
  given suggestion
* Add `#makeDefaultResult()`, which returns a result for suggestions that either
  don't need special handling or are unrecognized
* Remove the `RESULT_SUBTYPE` consts. The idea is that the client doesn't need
  to care too much about the types of results Merino returns, except when
  special handling is required (special UI, special telemetry, etc.)
* Add `telemetryType` to result payloads so that the result types recorded in
  Glean are clear and well defined. `telemetryType` is also used to tell the
  type of a result in general. For results that are served by Merino,
  `telemetryType` is the Merino provider name
* Streamline legacy telemetry handling a little, although hopefully we won't be
  doing too much legacy telemetry in the future

There are still open questions that this revision does not resolve, especially
the ability isolate suggestion-specific UI code in a nice way (dynamic result
types). I don't think this revision paints us into any corners.

Other changes:

* Properly document the `${source}_${type}` result types in metrics.yaml (added
  in D174209)
* For Glean result types, replace "suggest_sponsor" with "merino_adm_sponsored"
  and "rs_adm_sponsored", and replace "suggest_non_sponsor" with
  "merino_adm_nonsponsored" and "rs_adm_nonsponsored". This is more consistent
  with the `${source}_${providerName}` convention I'd like to establish.
* Remove code related to Nimbus exposures and a test
  (browser_quicksuggest_bestMatch.js). We aren't using Nimbus exposures anymore.
  We can always add it back if necessary.
* Don't record the custom contextual services pings for dynamic Wikipedia
  results. These pings are only necessary for adM suggestions.

Differential Revision: https://phabricator.services.mozilla.com/D177191
2023-05-08 01:27:28 +00:00
Dão Gottwald
53481047f1 Bug 1827904 - Enable the result menu by default on all channels. r=adw
Differential Revision: https://phabricator.services.mozilla.com/D175362
2023-04-13 17:37:19 +00:00