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
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
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
This adds moz-toggle.mjs as a module to load in the main newtab document
(cached or otherwise), and then converts the existing toggles to use
moz-toggle.
This also required me to bring in tokens-brand.css to get the right
colours for the toggle to appear.
There was some markup in the original panel that had the label exist outside
of the toggle, and some CSS grid styling to make it appear alongside it.
Thankfully, moz-toggle takes care of a lot of that for us, so I was able
to get rid of the external label element and the associated styles.
Differential Revision: https://phabricator.services.mozilla.com/D187716
This adds moz-toggle.mjs as a module to load in the main newtab document
(cached or otherwise), and then converts the existing toggles to use
moz-toggle.
This also required me to bring in tokens-brand.css to get the right
colours for the toggle to appear.
There was some markup in the original panel that had the label exist outside
of the toggle, and some CSS grid styling to make it appear alongside it.
Thankfully, moz-toggle takes care of a lot of that for us, so I was able
to get rid of the external label element and the associated styles.
Differential Revision: https://phabricator.services.mozilla.com/D187716
There's now a dedicated nsIQuotaManagerService::ClearStoragesForOriginPrefix
method for clearing storages for origin prefix. All callers of
nsIQuotaManagerService::ClearStoragesForPrincipal which want to clear all
storages for given origin prefix can be now converted to call the new method.
Changed done in this patch:
- replaced some nsIQuotaManagerService::ClearStoragesForPrincipal calls with
nsIQuotaManagerService::ClearStoragesForOriginPrefix
Differential Revision: https://phabricator.services.mozilla.com/D186778
This adds moz-toggle.mjs as a module to load in the main newtab document
(cached or otherwise), and then converts the existing toggles to use
moz-toggle.
This also required me to bring in design-tokens-brand.css to get the right
colours for the toggle to appear.
There was some markup in the original panel that had the label exist outside
of the toggle, and some CSS grid styling to make it appear alongside it.
Thankfully, moz-toggle takes care of a lot of that for us, so I was able
to get rid of the external label element and the associated styles.
Differential Revision: https://phabricator.services.mozilla.com/D187716