Commit Graph

152 Commits

Author SHA1 Message Date
Drew Willcoxon
f23e8f81c3 Bug 1945021 - Set result.isBestMatch instead of suggestion.is_top_pick. r=daisuke
Depends on D236300

Differential Revision: https://phabricator.services.mozilla.com/D236303
2025-02-04 01:16:49 +00:00
Drew Willcoxon
3fb3b02e20 Bug 1945016 - Remove quickSuggestAllowPositionInSuggestions and support for suggestion.position. r=daisuke
Differential Revision: https://phabricator.services.mozilla.com/D236300
2025-02-04 01:16:48 +00:00
Drew Willcoxon
6a9635076a Bug 1944441 - Move AMP timestamp template handling into AmpSuggestions. r=daisuke
Differential Revision: https://phabricator.services.mozilla.com/D235901
2025-01-30 00:17:35 +00:00
Drew Willcoxon
d384f73795 Bug 1943795 - Add BlockedSuggestions.blockResult() and don't set originalUrl unnecessarily. r=daisuke
Depends on D235389

Differential Revision: https://phabricator.services.mozilla.com/D235549
2025-01-27 23:24:43 +00:00
Drew Willcoxon
d7e7109d75 Bug 1943473 - Always set isSponsored on Suggest results and refactor "can add suggestion?" logic. r=daisuke
This makes a few changes:

Make sure we always set `result.payload.isSponsored` and base it on
`SuggestProvider.isSuggestionSponsored()` so that it's really clear. With that
change, we don't need to set `suggestion.is_sponsored` anymore. (I'm trying to
stop modifying suggestion objects so much because it's hard to follow.)

Don't call `feature.makeResult()` if the feature is disabled. I'm kind of
surprised we don't do this already, but it's always worked out in the end due to
a few reasons: (1) Some `feature.makeResult()` implementations return null if
their prefs are disabled (effectively duplicating their `shouldEnable` logic),
(2) we don't query the Rust component for disabled suggestions, and (3)
`#canAddSuggestion()` returns null if sponsored/nonsponsored suggestions are
disabled.

Replace `#canAddSuggestion()` with `#canAddResult()`. The logic can be
simplified and is easier to follow if we always deal with results instead of
suggestions. Examples: (1) We can check `result.payload.isSponsored` instead of
having to also set and check `suggestion.is_sponsored`. (2) When checking for
blocked suggestions, we can check `result.payload.originalUrl` instead of
leaking `suggestion.rawUrl` from the Rust component.

Differential Revision: https://phabricator.services.mozilla.com/D235389
2025-01-27 23:24:41 +00:00
Drew Willcoxon
92fbc49d02 Bug 1942435 - Fix dismissals for Merino suggestions that aren't managed by a Suggest feature. r=daisuke
I don't think we have any tests specifically for Merino suggestions that don't
correspond to Suggest features, i.e., suggestions with a Merino provider that is
technically unrecognized by Firefox. Dynamic Wikipedia suggestions and
navigational suggestions (a.k.a. top sites) are two examples. So I added tasks
for both sponsored and nonsponsored suggestions to make sure they're disabled
when the relevant pref is disabled, in addition to testing this bug itself.

Differential Revision: https://phabricator.services.mozilla.com/D234787
2025-01-21 02:29:14 +00:00
Drew Willcoxon
5f4b628014 Bug 1941989 - Split AdmWikipedia into two modules and send the quick-suggest ping only for AMP suggestions. r=daisuke
This makes two major changes:

Split `AdmWikipedia` into `AmpSuggestions` and `OfflineWikipediaSuggestions`. I
included "offline" in the name because Merino also serves Wikipedia suggestions,
but they're the so-called "dynamic Wikipedia" suggestions served from
Elasticsearch, and they have never been managed by a
`BaseFeature`/`SuggestFeature` in Firefox.

Send the `quick-suggest` ping only for AMP suggestions, in `AmpSuggestions`.
Stop sending it for offline Wikipedia suggestions. @bholley and I discussed this
on the data-review@mozilla.com list after I emailed it for the senstive data
review in D233752 [1]. We only use the ping for AMP suggestions, and Wikipedia
telemetry should follow the usual data opt-out. @nanj agreed the ping isn't
necessary for Wikipedia.

[1] https://groups.google.com/a/mozilla.com/g/data-review/c/BC2JKaXA7nA

Depends on D234440

Differential Revision: https://phabricator.services.mozilla.com/D234449
2025-01-17 02:34:38 +00:00
Drew Willcoxon
2b358f9832 Bug 1941100 - Move quick-suggest ping submission from UrlbarProviderQuickSuggest to AdmWikipedia. r=daisuke
This makes a number of changes. The main point is to fix the bug, and I did some
refactoring to accomplish that. Summary of changes:

Move submission of the `quick-suggest` ping from `UrlbarProviderQuickSuggest` to
`AdmWikipedia`.

Add `SuggestProvider.onImpression()` and `onEngagement()`.
`UrlbarProviderQuickSuggest` forwards its own impression and engagement method
calls to the methods on the appropriate Suggest features. This is how
`AdmWikipedia` knows when to submit the ping.

Add a `details` param to `UrlbarProvider.onImpression()`, just like
`onEngagement()` already has. This is necessary because
`AdmWikipedia.onImpression()` needs to know whether the result was clicked since
that info is part of the impression ping.

Replace all `SuggestFeature.handleCommand()` implementations with
`onEngagement()`.

Remove `UrlbarProviderQuickSuggest.#dismissResult()`. The only suggestion types
that relied on it were AMP and Wikipedia. I replaced it with dismissal handling
in `AdmWikipedia.onEngagement()`.

Improve the related tests in a few ways: (1) Make the ping check more rigorous
(in `assertQuickSuggestPing()` in `head.js`), (2) simplify expected ping objects
(no more `type` and `payload` properties, just the properties that are expected
in the ping), (3) make `browser_telemetry_gleanEmptyStrings.js` more rigorous,
(4) factor out a helper function to trigger commands in xpcshell tests.

Differential Revision: https://phabricator.services.mozilla.com/D233980
2025-01-14 19:54:56 +00:00
Drew Willcoxon
d0b28ed60b Bug 1936457 - Add a Suggest backend class for Merino. r=daisuke,nanj
This adds `SuggestBackendMerino` and `QuickSuggest.backends`, an array that
contains all backends. So now we have Rust, ML, and Merino backends.

This also makes some changes to relevancy ranking (added in bug 1923187) because
that was done in `_fetchMerinoSuggestions()`, which this patch removes.
Previously, ranking was applied to all Merino suggestions at once. With this
patch, it's applied to each suggestion as it's visited by
`#filterAndSortSuggestions()`, which is now the right place to do it IMO. It
will be easy to expand it to non-Merino suggestions now if we want.

Depends on D232022

Differential Revision: https://phabricator.services.mozilla.com/D231863
2024-12-17 18:37:04 +00:00
Drew Willcoxon
ca65a9a803 Bug 1936951 - Rename BaseFeature to SuggestFeature and factor it out into SuggestProvider and SuggestBackend. r=daisuke
This does several things, and I'll update D231863 so it builds on it:

Rename `BaseFeature` to `SuggestFeature` since only Suggest uses it and it's
pretty deeply integrated with `QuickSuggest` at this point.

Factor out all the suggestions/provider-specific methods into a new
`SuggestProvider` subclass. All features that manage suggestions are now
subclasses of `SuggestProvider` instead of `BaseFeature`.

Add a new subclass called `SuggestBackend` that codifies the expected backend
methods.

Rename `Weather` to `WeatherSuggestions` to be more consistent with the other
feature subclasses.

Update a bunch of comments so hopefully they're clearer and more accurate. I
also replaced the term "quick suggest" with "Suggest".

It doesn't make any substantive changes beyond the above.

Differential Revision: https://phabricator.services.mozilla.com/D232022
2024-12-17 18:37:03 +00:00
Drew Willcoxon
85301b6753 Bug 1932502 - Remove the Suggest JS backend: Part 3: Remove the "remote-settings" and "rs_" source. r=daisuke
This is part 3 of 4. It removes the `"remote-settings"` source used internally
and its `rs_` counterpart in telemetry result types.

Depends on D231466

Differential Revision: https://phabricator.services.mozilla.com/D231467
2024-12-11 20:50:46 +00:00
Drew Willcoxon
2033165d91 Bug 1932502 - Remove the Suggest JS backend: Part 2: Remove the backend. r=daisuke
This is part 2 of 4, the main part. It removes the backend and the code in
`BaseFeature` and feature subclasses that hook into it. As a consequence it also
makes the other following changes:

* Remove `QuickSuggest.backend` (eventually I'd like to add a Merino backend and
  then add a new `QuickSuggest.backends` list that has the Rust, Merino, and ML
  backends)
* Add `QuickSuggest.config`
* Replace uses of `QuickSuggest.backend.config` and `QuickSuggest.jsBackend.config`
  with `QuickSuggest.config`
* Remove the `quickSuggestRustEnabled` Nimbus variable
* Update most remaining tests so that they do not assume the JS backend exists

I left the `browser.urlbar.quicksuggest.rustEnabled` pref. I would like to
preserve the ability to toggle off Rust suggestions while keeping other parts of
Suggest enabled even if we don't need it now. That seems like a wise thing to do
and is similar to how both Merino and the ML backends can be toggled separately.

Depends on D231465

Differential Revision: https://phabricator.services.mozilla.com/D231466
2024-12-11 20:50:45 +00:00
Drew Willcoxon
27e74e304d Bug 1932807 - Stop using JSON.stringify() in urlbar logging. r=urlbar-reviewers,Standard8
This also downgrades and removes some logging that I myself added that hasn't
proven to be useful. I reworded messages I wrote in a few places too.

I didn't touch `SuggestBackendJs.sys.mjs` because it's unused and will likely be
removed soon (bug 1932502).

Depends on D229847

Differential Revision: https://phabricator.services.mozilla.com/D229868
2024-11-22 22:20:57 +00:00
Drew Willcoxon
87b244a551 Bug 1930147 - Trim and lowercase the search string passed in to MLSuggest.makeSuggestions(). r=daisuke
I told Chidam we would trim and lowercase the search string passed in to
`MLSuggest.makeSuggestions()` but I forgot to do it. This fixes the bug. More
discussion here: https://mozilla-hub.atlassian.net/browse/QA-2738?focusedCommentId=962570

Differential Revision: https://phabricator.services.mozilla.com/D228524
2024-11-11 02:59:56 +00:00
Drew Willcoxon
aa56c40785 Bug 1926381 - Integrate MLSuggest with UrlbarProviderQuickSuggest and implement Yelp ML suggestions. r=daisuke
This adds a new Suggest backend for ML-based suggestions called
`SuggestBackendMl`. Before, with the JS and Rust backends, only one backend was
enabled at a time, but both the ML and Rust backends can be enabled at the same
time since we will want to serve suggestions from both for the foreseeable
future. Features can support ML suggestions by implementing the new
`BaseFeature.mlIntent` getter and handling ML suggestions in `makeResult()`.
Each feature can decide whether it supports ML suggestions and whether they
should be preferred over Rust suggestions.

I've updated the Yelp feature to hook into this, since Yelp suggestions are
supported by the ML model that Chidam is working on. If ML is enabled, then the
feature will only serve ML suggestions. I'm not sure if that's what we want long
term, but for now that will make it clear to people which backend is being used
while we develop this feature.

The `quickSuggestMlEnabled` variable/pref determines whether the ML backend is
enabled. The `yelpMlEnabled` variable/pref determines whether Yelp ML
suggestions are enabled. We can create similar variable/prefs for each feature
that supports ML suggestions so that they can be toggled independently of each
other.

Other changes:

Move the `is_sponsored` logic out of the Rust backend and into the provider.
Otherwise it would need to be duplicated in the ML backend too.

Depends on D224523

Differential Revision: https://phabricator.services.mozilla.com/D226736
2024-10-24 09:52:00 +00:00
Nan Jiang
7b2fd8965f Bug 1926315 - Add telemetry for relevance ranking of Firefox Suggest r=adw,urlbar-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D226672
2024-10-23 22:18:31 +00:00
Drew Willcoxon
b78d8f3b9a Bug 1921126 - Add desktop support for city-based weather suggestions. r=daisuke
This adds support for city-based weather suggestions from Rust, i.e., queries
that contain city and region names.

When Rust detects a weather query with a city, it sets three suggestion
properties: `city`, `region`, and `country`. All three properties will be set
because the Rust component knows which cities are in which regions and
countries, and it will only set the properties if it detects a city name. If a
name matches multiple cities and the query doesn't contain a region, Rust will
return multiple suggestions, one suggestion per city-region, and the suggestions
will be ordered by population size, largest to smallest.

Rust uses data from GeoNames to detect locations. We store GeoNames data in
remote settings and ingest it into the Rust DB, just like we do for suggestions
and keywords. This patch uses some mock GeoNames data in the test.

More info on the Rust part of this in the PR:
https://github.com/mozilla/application-services/pull/6406

For the Merino part, Merino now supports a few extra params for weather
suggestions: city, region, and country. So when the Rust component returns a
weather suggestion with those properties set, we can pass them to Merino to get
a weather suggestion for that location.

This patch adds a new `BaseFeature` method called `filterSuggestions()`. The
important thing about this method is that it's passed all the feature's
suggestions that were matched in the query. The feature can use this info to
determine which suggestion(s) to show. Right now, `Weather` uses it to discard
all weather suggestions except the first one, which means it will show the
suggestion with the largest city population (if the first suggestion has a
city). In the future, I'd like to explore better options like picking the
suggestion whose city name best matches the user's location.

Depends on D226215

Differential Revision: https://phabricator.services.mozilla.com/D226584
2024-10-23 06:54:44 +00:00
Florian Quèze
6ac3c84fb1 Bug 1925355 - Remove contextual.services.quicksuggest legacy telemetry scalars, r=adw,urlbar-reviewers.
Differential Revision: https://phabricator.services.mozilla.com/D226039
2024-10-18 08:57:18 +00:00
Nan Jiang
74d5157add Bug 1924194 - Provide a mapping table for Interest enum r=adw,bdk,urlbar-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D225715
2024-10-16 18:40:00 +00:00
Nan Jiang
ed574ceeb5 Bug 1923187: part 2 - Add experimental ranking for Merino suggestions r=adw,bdk
Differential Revision: https://phabricator.services.mozilla.com/D225141
2024-10-11 02:33:02 +00:00
Florian Quèze
9028981ddf Bug 1921748 - Remove contextservices.quicksuggest legacy telemetry events, r=chutten,urlbar-reviewers,adw.
Differential Revision: https://phabricator.services.mozilla.com/D222808
2024-10-02 14:34:02 +00:00
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