Commit graph

63 commits

Author SHA1 Message Date
Drew Willcoxon
f0b457683b Bug 1730618 - Allow Nimbus to enable Firefox Suggest online and override the offline default. r=mythmon,preferences-reviewers,mstriemer
This reworks the fix to bug 1729776.

Currently Nimbus doesn't have a way to force the two suggestions prefs [1] on or
off. That might seem surprising since we've run experiments already. Initially
we defaulted the two prefs to true but we defaulted the separate feature-gate
pref [2] to false, and it was the feature-gate pref we controlled via Nimbus. At
some point we changed the defaults to false and then in Firefox flipped them to
true after showing the onboarding dialog. As a result we've never needed to
override the two suggestion prefs via Nimbus.

The problem now is that we default-enable offline (for US en users), so we set
all three prefs to true. For the online rollout, we need to keep the
feature-gate pref enabled but disable the suggestion prefs, and there's no way
to do that.

My first idea was to add new Nimbus variables to override the two suggestion
prefs. The prefs would keep their default true values but be overridden by
Nimbus. But that doesn't work because there's no way for Firefox to tell whether
the prefs are true because the user has opted in (overriding Nimbus) or because
they still have their default values. Setting the prefs to true on the user
branch doesn't have any effect because they're also true on the default branch.
Or maybe there's a way I don't know about to force them to true on the user
branch, but even if there were, it seems brittle to rely on a value being set on
the user branch to distinguish between the two cases. (This is a potential
problem for any prefs that are controlled by both Nimbus and the user. So far
the prefs we've been using via Nimbus have all been hidden feature-gate-type
things and implementation details.)

We already have a `quickSuggestScenario` variable. We currently use it only to
tell what we should send in the telemetry ping (bug 1729576) and whether some
parts of the prefs UI should be shown. This revision makes it much more
important by treating it as the source of truth for the user's scenario. It now
determines the default values of related prefs, including the two suggestions
prefs.

The logic is:

```
If quickSuggestScenario is non-null:
  scenario = quickSuggestScenario
Else (e.g., there's no rollout):
  If the user is US en:
    scenario = offline
  Else:
    scenario = history
```

After determining the scenario, it's set it as
`browser.urlbar.quicksuggest.scenario` on the default branch. There's an
existing pref observer in UrlbarPrefs, and I added a case for this pref so that
when it's updated we also update all the other prefs that depend on the
scenario. This way when the pref is set -- either due to Nimbus update or by
changing it on about:config -- all the other prefs stay in sync.

I kept the default value of `browser.urlbar.quicksuggest.scenario` but removed
it as the fallback for `quickSuggestScenario`. If it still both had a default
and remained the fallback, then it would be impossible to tell when Nimbus is
trying to override it, because any fetch of the value from Nimbus would just
return the fallback pref's value if there is no override.

I considered instead removing the default value and keeping it as the fallback.
The drawback of that is that unenrollments would not take effect until restart.
I actually tried this approach first, and in tests, after mock experiments were
unenrolled, the pref values remained what they were when the experiment was
active.

It might also be possible to not have the `browser.urlbar.quicksuggest.scenario`
pref at all. We could call NimbusFeatures directly to get the scenario. However,
currently we cache and access Nimbus variables through UrlbarPrefs, as we do
with prefs, and I don't want to add an inconsistency.

This revision also fixes bug 1730596 since it was easy to do given that I needed
a way to prevent indirect recursive updates to the scenario, and I can use that
for bug 1730596 too (the `_updatingFirefoxSuggestScenario` bool).

[1] `browser.urlbar.suggest.quicksuggest` and `browser.urlbar.suggest.quicksuggest.sponsored`
[2] `browser.urlbar.quicksuggest.enabled`

Differential Revision: https://phabricator.services.mozilla.com/D125511
2021-09-16 18:28:02 +00:00
Kate Hudson
2df2b827f0 Bug 1728843 - Add once option to NimbusFeatures.recordExposureEvent r=andreio
Differential Revision: https://phabricator.services.mozilla.com/D124381
2021-09-13 14:35:15 +00:00
Alexandru Michis
bf70c93173 Backed out changeset 92b9d5110599 (bug 1728843) for causing bc failures in browser_urlbar_telemetry_quicksuggest.js
CLOSED TREE
2021-09-09 04:23:16 +03:00
Kate Hudson
7ce670b735 Bug 1728843 - Add once option to NimbusFeatures.recordExposureEvent r=andreio
Depends on D123763

Differential Revision: https://phabricator.services.mozilla.com/D124381
2021-09-09 00:20:56 +00:00
Nan Jiang
416a5acd40 Bug 1729576 - Add various telemetry changes for Firefox Suggest r=adw
* Add 'scenario' to impression and click pings
* Only send 'search_query' and 'matched_keywords' for 'online' scenario

Differential Revision: https://phabricator.services.mozilla.com/D124943
2021-09-08 21:22:32 +00:00
Alexandru Michis
b8ec12a7f7 Backed out changeset 2bc69d6f8a0c (bug 1729576) for causing crashes in browser_urlbar_telemetry_quicksuggest.js
CLOSED TREE
2021-09-08 23:34:10 +03:00
Nan Jiang
280ad07edf Bug 1729576 - Add various telemetry changes for Firefox Suggest r=adw
* Add 'scenario' to impression and click pings
* Only send 'search_query' and 'matched_keywords' for 'online' scenario

Differential Revision: https://phabricator.services.mozilla.com/D124943
2021-09-08 19:29:41 +00:00
Marian-Vasile Laza
e0469a2db1 Backed out changeset 47b9c109e74c (bug 1728843) for causing bc failures on browser_urlbar_telemetry_quicksuggest.js. CLOSED TREE 2021-09-07 18:45:09 +03:00
Kate Hudson
a2367c38e3 Bug 1728843 - Add once option to NimbusFeatures.recordExposureEvent r=andreio
Depends on D123763

Differential Revision: https://phabricator.services.mozilla.com/D124381
2021-09-07 13:49:51 +00:00
Drew Willcoxon
e315af21e1 Bug 1728429 - Update the Firefox Suggest Sponsored action text by wrapping the action text. r=dao
Summary of changes:

* Remove the Sponsored action text for Firefox Suggest sponsored results
* Instead show Sponsored below their titles
* Remove the Firefox Suggest action text for non-sponsored results

This uses the action text for "Sponsored" as we do now, but it wraps it below
the title.

The Figma spec (link in Jira ticket) shows URLs in Firefox Suggest results, the
same as history results. I asked Natalie about it, and that's not correct, or at
least we shouldn't implement that now. If we do need to show URLs, then this
approach is probably worse than D124519 because wrapping the action would also
force the URL on a new line since the URL comes after it.

Differential Revision: https://phabricator.services.mozilla.com/D124563
2021-09-06 20:14:47 +00:00
Drew Willcoxon
aeaf5b02d8 Bug 1728430 - Part 1: Add a separate pref for sponsored Firefox Suggest results. r=mak
The Jira ticket (link in the bug) calls for two separate checkboxes for Firefox
Suggest results: a main checkbox plus a sponsored-suggestions checkbox. The
sponsored-suggestions checkbox is subordinate to the main checkbox, i.e., the
main checkbox has to be checked to turn on sponsored suggestions. This will
allow users to toggle sponsored suggestions separately from non-sponsored
suggestions. It's a change from the current situation where we have only one
pref and checkbox that control both sponsored and non-sponsored suggestions.

So part 1 of fixing this bug is to add a new pref for sponsored suggestions.
This revision keeps the current `suggest.quicksuggest` pref as the main pref and
adds a new `suggest.quicksuggest.sponsored` pref. I confirmed with Natalie that
we want to enable both prefs when the user opts in through the onboarding
dialog.

We currently record a telemetry event when `suggest.quicksuggest` is toggled. We
also want a similar event for the new pref, so this adds one.

The pref situation for Firefox Suggest is confusing but in summary:

* `browser.urlbar.quicksuggest.enabled`: The global toggle for the entire
  Firefox Suggest rollout involving sponsored and non-sponsored suggestions, the
  related telemetry and preferences UI, etc. This pref can be overridden by the
  `quickSuggestEnabled` Nimbus variable. If false, neither sponsored nor
  non-sponsored suggestions will be shown. If true, then we look at the
  individual `suggest.quicksuggest` and `suggest.quicksuggest.sponsored` prefs.
* `browser.urlbar.suggest.quicksuggest`: Whether any Firefox Suggest results are
  shown. This must be true to show both non-sponsored and sponsored results.
* `browser.urlbar.suggest.quicksuggest.sponsored`: Whether sponsored Firefox
  Suggest results are shown. Both this pref and `suggest.quicksuggest` must be
  true to show sponsored results.

Differential Revision: https://phabricator.services.mozilla.com/D124300
2021-09-06 18:56:10 +00:00
Nan Jiang
c1e91a89c5 Bug 1728188 - Re-enable the collection of search query and matched keyword for Firefox Suggest r=adw
Differential Revision: https://phabricator.services.mozilla.com/D124463
2021-09-03 16:16:56 +00:00
Drew Willcoxon
82da5cd8a6 Bug 1727799 - Add telemetry probe to measure Merino latency. r=mythmon,mak
This uses `TelemetryStopwatch` to record the time between the `fetch` start and
its resolve. The new histogram is `FX_URLBAR_MERINO_LATENCY_MS`.

Depends on D124132

Differential Revision: https://phabricator.services.mozilla.com/D123993
2021-09-01 16:03:51 +00:00
Drew Willcoxon
97b566d849 Bug 1728459 - Add support for scores in the Firefox Suggest Merino integration. r=nanj
This looks for a `score` property in suggestions from both Merino and remote
settings and picks the suggestion with the highest score. The score is intended
to be normalized -- i.e., in the range [0, 1] -- but currently it doesn't
matter. As discussed, I hardcoded a score of 0.2 for remote settings
suggestions.

When Merino returns multiple suggestions, currently we're just picking the first
one, but now we can pick the one with the highest score without any extra work,
so I went ahead and made sure we handle that now.

Also, this is robust against Merino not including a `score` in the response. In
that case we'll prefer the remote settings suggestion if there is one, and we'll
use the Merino suggestion if there's not.

Finally I added some new test tasks that aren't specifically related to scoring:
testing cases where either Merino or remote settings returns suggestions but not
both. I noticed I missed those cases earlier.

Differential Revision: https://phabricator.services.mozilla.com/D124132
2021-08-31 23:55:22 +00:00
Drew Willcoxon
4381b30b23 Bug 1727668 - Integrate Merino with Firefox Suggest/quick suggest. r=mak,nanj
This integrates a fetch to Merino in UrlbarProviderQuickSuggest. We continue to
do the remote settings fetch too. Per the Jira ticket, we should prefer the
Merino suggestion when both sources return one.

Each fetch is controlled by a new pref and Nimbus variable, so we can enable
them independently.

At first I started making a UrlbarProviderMerino class, but it's better to
modify UrlbarProviderQuickSuggest because everything besides the fetch source is
the same: We want to collect the same telemetry, have the same results and
payloads, etc.

Depends on D123852

Differential Revision: https://phabricator.services.mozilla.com/D123707
2021-08-30 22:48:12 +00:00
Dão Gottwald
030b26fc0f Bug 1727907 - Make Firefox Suggest an opt-in feature and update the onboarding dialog accordingly. r=daleharvey
Differential Revision: https://phabricator.services.mozilla.com/D123852
2021-08-30 15:56:28 +00:00
Drew Willcoxon
a21508d7d8 Bug 1727392 - Send Firefox Suggest Nimbus exposure ping when a Firefox Suggest result is shown. r=nanj
Differential Revision: https://phabricator.services.mozilla.com/D123517
2021-08-24 22:59:00 +00:00
Drew Willcoxon
01602c92b9 Bug 1709511 - Add a preview Fluent file for Firefox Suggest. r=harry,fluent-reviewers,preferences-reviewers,flod
This adds preview localizations for remaining Firefox Suggest strings.

I removed support for `payload.helpTitle` and `sponsoredText`. The `helpTitle`
code comment says it's useful for experiments with hardcoded strings, but we're
not shipping experiments as extensions anymore, and in-tree experimental/
in-development features should use preview localizations AFAICT.

Covered by existing tests:

* browser/components/urlbar/tests/browser/browser_helpUrl.js
* browser/components/urlbar/tests/browser/browser_quickSuggest*
* browser/components/preferences/tests/browser_searchQuickSuggest.js

Depends on D122550

Differential Revision: https://phabricator.services.mozilla.com/D123032
2021-08-23 19:47:16 +00:00
Drew Willcoxon
b11bea8e81 Bug 1710518 - Introduce group-relative suggestedIndex and modify quick suggest results to use it. r=harry
This introduces a new `result.isSuggestedIndexRelativeToGroup` property. When
true, `result.suggestedIndex` is relative to the result's group.

We can get rid of some hardcoded quick-suggest things with this.

I considered a `relativeSuggestedIndex` property that would replace
`suggestedIndex`, but it would have made `muxer._addSuggestedIndexResults` a
little more complex because it would need to know whether it should use
`relativeSuggestedIndex` or `suggestedIndex`. `UrlbarView._rowCanUpdateToResult`
would also need to be updated since it checks for suggestedIndex results. But
there are trade-offs either way and I'm open to using `relativeSuggestedIndex`.

While working on this I noticed that we broke the position of quick suggest
results in bug 1662167. They're supposed to be last in the outer general group,
and currently the muxer is hardcoded to put them last in `GENERAL`, but after
that bug `INPUT_HISTORY` actually comes last. To fix that I added a new
`GENERAL_PARENT` group that's used for the outer general group. Quick suggest
results now use this group, combined with a relative `suggestedIndex`, to come
last. I wanted to rename `GENERAL` to `PLACES` or `BOOKMARKS_HISTORY` and use
`GENERAL` for the outer group, but we use `GENERAL` in a ton of places (tests
especially) and I didn't want to touch blame for it all. I'm open to better
names than `GENERAL_PARENT`. I considered `FIREFOX_SUGGEST` but I don't think
it's a good idea to tie it to specific branding that may change.

Differential Revision: https://phabricator.services.mozilla.com/D122799
2021-08-19 00:04:08 +00:00
Nan Jiang
294f7653d2 Bug 1725492 - Disable search query collection for Firefox Suggest r=adw
Differential Revision: https://phabricator.services.mozilla.com/D122535
2021-08-13 00:32:47 +00:00
Nan Jiang
db1888a718 Bug 1724076 - Add nimbus exposure event for Firefox Suggest experiments r=adw,andreio
Differential Revision: https://phabricator.services.mozilla.com/D122118
2021-08-09 18:38:10 +00:00
Drew Willcoxon
5a341fb860 Bug 1717719 - Don't show quick suggest results in private windows. r=daleharvey
Differential Revision: https://phabricator.services.mozilla.com/D118548
2021-06-23 20:04:56 +00:00
Nan Jiang
1fb559ba1d Bug 1714344 - Replace the deprecated Nimbus.url.getValue calls r=adw,andreio,preferences-reviewers,jaws
Differential Revision: https://phabricator.services.mozilla.com/D116724
2021-06-03 23:19:56 +00:00
Drew Willcoxon
5e03c56e0c Bug 1711792 - Allow quick suggest results to appear at Nimbus-configurable positions within the general bucket. r=mak,nanj
This adds two new Nimbus urlbar variables:

* `quickSuggestSponsoredIndex`
* `quickSuggestNonSponsoredIndex`

They work similarly to `suggestedIndex` except they're relative to the general
bucket. We have bug 1710518 for finding a more general way to accomplish this.

I made a new test file instead of adding to browser_quicksuggest.js because I
wanted to test various indexes, and that's not easily doable with the current
test since it sets up a mock experiment right at the beginning, and AFAIK it's
not possible to change a (mock) experiment's variables or override them with
prefs. A new file specifically for this feature doesn't seem like a bad idea
anyway.

The new test copy-pastes some boilerplate from browser_quicksuggest.js. I
considered factoring it out, but I'd like to keep this patch simple since
product may want to uplift it, and in bug 1709741 I have a larger patch that
includes similar refactoring.

Differential Revision: https://phabricator.services.mozilla.com/D115437
2021-05-20 22:25:21 +00:00
Drew Willcoxon
00b6e01347 Bug 1711449 - Don't assume the quick suggest result is last when recording telemetry. r=daleharvey
Differential Revision: https://phabricator.services.mozilla.com/D115303
2021-05-18 18:26:18 +00:00
Drew Willcoxon
752fb9ad29 Bug 1709992 - Show the Quick/Firefox Suggest row at the end of the general bucket. r=mak
This might be a little hacky because it builds special handling of quick suggest
results into the muxer instead of using some general solution. I have ideas for
general solutions, but they would all be larger than this patch, and we want to
uplift this to 89.

Differential Revision: https://phabricator.services.mozilla.com/D114669
2021-05-10 21:27:04 +00:00
Nan Jiang
978ac07ba3 Bug 1709088 - Allow QuickSuggest experiment to skip the opt-in modal r=andreio,daleharvey,adw
Differential Revision: https://phabricator.services.mozilla.com/D114094
2021-05-06 16:18:56 +00:00
Drew Willcoxon
c01e01528d Bug 1708621 - Add experimental Firefox Suggest label in the urlbar view to support Firefox Suggest experiments. r=mak,nanj
Differential Revision: https://phabricator.services.mozilla.com/D114203
2021-05-06 02:32:25 +00:00
Dale Harvey
ac0008f25b Bug 1708292 - Remove unused UrlbarPref for quicksuggest. r=adw
Differential Revision: https://phabricator.services.mozilla.com/D113710
2021-04-29 16:42:19 +00:00
Dale Harvey
ed370e6a5f Bug 1702079 - Implement the opt-in modal for Firefox QuickSuggest r=adw
Differential Revision: https://phabricator.services.mozilla.com/D110569
2021-04-27 10:00:07 +00:00
Cosmin Sabou
34e7e8dc2d Backed out changeset a8d01d3d99fc (bug 1702079) for bc failures on browser_urlbar_telemetry_quicksuggest.js. CLOSED TREE 2021-04-27 01:59:11 +03:00
Dale Harvey
508fc53c33 Bug 1702079 - Show onboarding prompt to enable QuickSuggest r=adw
Differential Revision: https://phabricator.services.mozilla.com/D110569
2021-04-26 22:20:10 +00:00
Cosmin Sabou
e1a2f4a163 Backed out changeset f2cab762429f (bug 1702079) for bc failures on browser_urlbar_telemetry_quicksuggest.js. CLOSED TREE 2021-04-21 23:04:10 +03:00
Dale Harvey
2c3b01b7fc Bug 1702079 - Show onboarding prompt to enable QuickSuggest r=adw
Differential Revision: https://phabricator.services.mozilla.com/D110569
2021-04-21 19:06:11 +00:00
Andrei Oprea
ba84870a14 Bug 1699701 - Convert all usages of ExperimentFeature to singleton API r=k88hudson
Differential Revision: https://phabricator.services.mozilla.com/D110284
2021-04-09 14:13:13 +00:00
Sebastian Hengst
ebd583fd80 Backed out changeset d402c8657d3f (bug 1699701) for failing newtab's activity-stream:AboutPreferences Feed and more. CLOSED TREE 2021-04-09 15:35:48 +02:00
Andrei Oprea
c7084aa8a7 Bug 1699701 - Convert all usages of ExperimentFeature to singleton API r=k88hudson
Differential Revision: https://phabricator.services.mozilla.com/D110284
2021-04-09 12:49:00 +00:00
Drew Willcoxon
a6c437c109 Bug 1701136 - Make quick suggest's suggestedIndex -1 instead of maxResults - 1. r=daleharvey
With bug 1699227 and bug 1701193 fixed, we can now use -1 as the quick suggest
result's suggested index to make it stick to the bottom of the view without any
flickering.

Differential Revision: https://phabricator.services.mozilla.com/D110636
2021-04-05 19:43:17 +00:00
Andrei Oprea
4b3335c6fd Bug 1694472 - Update UrlbarPrefs to use ExperimentFeature r=k88hudson,mak
Differential Revision: https://phabricator.services.mozilla.com/D106269
2021-03-23 10:26:26 +00:00
Drew Willcoxon
275912b943 Bug 1697678 - Choose quick suggest suggestions only from matching results. r=daleharvey
Differential Revision: https://phabricator.services.mozilla.com/D107973
2021-03-11 21:00:15 +00:00
Dale Harvey
8d3a00eaf8 Bug 1697003 - Update strings for Firefox Suggest experiment r=adw
Differential Revision: https://phabricator.services.mozilla.com/D107525
2021-03-09 12:59:03 +00:00
Drew Willcoxon
2f0a9b2b45 Bug 1697035 - Change quick suggest SUMO support page from "sponsored-search" to "firefox-suggest". r=daleharvey
Differential Revision: https://phabricator.services.mozilla.com/D107541
2021-03-08 21:39:11 +00:00
Drew Willcoxon
848eac0224 Bug 1696061 - Always show the help button in quick suggest results and remove onboarding code. r=nanj
Depends on D107012

Differential Revision: https://phabricator.services.mozilla.com/D107015
2021-03-03 05:33:01 +00:00
Drew Willcoxon
14eefa1933 Bug 1693671 - Update the Quick Suggest help URL. r=daleharvey,Gijs
We're going with a SUMO page after all and not a blog URL.

Depends on D106940

Differential Revision: https://phabricator.services.mozilla.com/D107012
2021-03-03 00:48:01 +00:00
Dale Harvey
2ea615643a Bug 1695676 - Preload QuickSuggest before UrlBar is initialised r=adw
Differential Revision: https://phabricator.services.mozilla.com/D106940
2021-03-02 23:58:51 +00:00
Dale Harvey
4de60850ce Bug 1692536 - Highlight where users input matches QuickSuggest result. r=adw
Differential Revision: https://phabricator.services.mozilla.com/D106833
2021-03-02 09:03:00 +00:00
Drew Willcoxon
be1902fff1 Bug 1692527 - Show "Firefox Suggests" instead of "Sponsored" for non-sponsored quick suggest results. r=daleharvey
Depends on D106490

Differential Revision: https://phabricator.services.mozilla.com/D106559
2021-02-26 18:40:33 +00:00
Nan Jiang
47fca6093a Bug 1689365 - Add custom impression and click for QuickSuggest r=adw,daleharvey
Differential Revision: https://phabricator.services.mozilla.com/D106490
2021-02-25 22:17:12 +00:00
Dale Harvey
cfe3d13030 Bug 1694694 - Ensure QuickSuggest searches are case insensitive r=adw
Differential Revision: https://phabricator.services.mozilla.com/D106326
2021-02-25 14:57:35 +00:00
Drew Willcoxon
5c28daf615 Bug 1693126 - Add telemetry for when users disable Quick Suggest. r=harry,nanj
This adds event telemetry that's recorded when the
`browser.urlbar.suggest.quicksuggest` pref is toggled. This pref corresponds to
the checkbox in about:preferences#search labeled "Show suggested and sponsored
results in the address bar".

I used `contextservices.quicksuggest` as the event telemetry category name to be
similar to the `contextual.services.quicksuggest.*` scalars. Event names are
limited to 30 chars, so it couldn't be exactly the same.

This is based on my earlier revision for scalar telemetry in D106173.

Depends on D106173

Differential Revision: https://phabricator.services.mozilla.com/D106248
2021-02-25 06:21:32 +00:00