Commit Graph

205 Commits

Author SHA1 Message Date
mcheang
9864559021 Bug 1648188 - Fix SearchService init failures so that the address bar can be used to search history and bookmarks. r=Standard8,mak
This patch refactors the SearchService private initialized variables and how
the SearchService stores its initialization status. These changes capture whether
the SearchService has succeeded, failed or hasn't finished initialization yet.

There are also changes made to UrlbarSearchUtils on handling when SearchService
has failed to initialize or when it hasn't finished initializing yet and we wait.
In the case where the SearchService has failed on initialization, We allow
the code to continue so that it can reach UrlbarProviderPlaces. Once we
are able to reach UrlbarProviderPlaces, we can make database calls for the user's
history and bookmarks. This allows the user to interact with the addressbar and
search their history and bookmarks even if SearchService has failed to initialize.

Differential Revision: https://phabricator.services.mozilla.com/D176936
2023-05-30 18:34:51 +00:00
Dale Harvey
520a2bc7a9 Bug 1832518 - Show overflow fade when rich suggestions are cropped. r=dao
Differential Revision: https://phabricator.services.mozilla.com/D178600
2023-05-23 14:42:59 +00:00
Drew Willcoxon
ddcd315951 Bug 1833161 - Properly restore selection when showing the dismissal acknowledgment tip. r=ahal,dao
The problem is the row remains selected after its content is replaced with the
dismissal acknowledgment tip. This patch clears the selection and selects the
tip's "Got it" button if the row was selected.

I didn't add a general browser test for feedback and dismissal acknowledgments
earlier, so I added one now. I cp'ed the weather test and used it as a starting
point since it does test the acknowledgments but is specific to the weather
suggestion. Even though some of it now duplicates the new test, I left it intact
because we still need a test for the weather-specific commands, and the amount
of duplicated code isn't very much.

I modified the test helper function that opens the result menu so that the row
is not selected when `byMouse` is true. That way I can make sure the selection
doesn't change when the dismissed row is not selected. I used
`EventUtils.promiseElementReadyForUserInput()` to synthesize a mousemove over
the row to make the menu button visible. That function has a bug where the
interval is added after `onHit` is called and the promise is resolved, leaving
the interval ticking forever. Moving the `synthesizeMouseAtCenter()` after the
timeout is created fixes the problem.

Differential Revision: https://phabricator.services.mozilla.com/D178264
2023-05-19 22:13:10 +00:00
Daisuke Akatsuka
7e8b9adf64 Bug 1833966: Show Firefox Suggest row label when best match is not enabled r=adw
Differential Revision: https://phabricator.services.mozilla.com/D178488
2023-05-19 04:53:03 +00:00
Drew Willcoxon
dd3f90bea7 Bug 1831760 - Use a native popup menu for positioned popups on Mac. r=dao,mstange
This does two things:

* Modify `nsXULPopupManager::ShowPopup()` so it calls `ShowPopupAsNativeMenu()`
  as long as an anchor wasn't passed in, and only on Mac.
* Modify `-[MOZMenuOpeningCoordinator _openMenu:atScreenPosition:forView:withAppearance:]`
  so it also takes a `aIsContextMenu` param. If the param is true, we synthesize
  a right-click event and pop up a context menu as usual. If it's false, we use
  `-[NSMenu popUpMenuPositioningItem:atLocation:inView:]` instead.

The reason this works is because `-[NSMenu popUpMenuPositioningItem:atLocation:inView:]`
opens the menu in a sensible place when the x-y coords are near the right edge
of the screen. In contrast, `+[NSMenu popUpContextMenu:withEvent:forView:]` will
anchor the menu's top-right corner to the mouse cursor when near the right edge.

Differential Revision: https://phabricator.services.mozilla.com/D177355
2023-05-18 05:51:19 +00:00
Drew Willcoxon
6658471116 Bug 1832826 - Add a way to invalidate cached result menu commands and use it when the weather min keyword length cap is reached. r=dao
Differential Revision: https://phabricator.services.mozilla.com/D177954
2023-05-18 02:23:07 +00:00
Dale Harvey
a8d49a9e03 Bug 1826447 - Initial support for Rich Suggestions. r=dao
Differential Revision: https://phabricator.services.mozilla.com/D174693
2023-05-11 21:27:36 +00:00
Drew Willcoxon
dd2a850370 Bug 1832105 - Add the weather suggestion commands to the isSessionOngoing logic in the urlbar telemetry event code. r=daisuke
The problem is the two weather commands that keep the view open,
"inaccurate_location" and "show_less_frequently", aren't included in the
criteria that set `isSessionOngoing` to true.

As the comment above `isSessionOngoing` says, we should find a better way to
determine whether the session remains ongoing than hardcoding a list of
commands. I didn't try to do that here since we're time constrained and need to
uplift this to 114.

Differential Revision: https://phabricator.services.mozilla.com/D177558
2023-05-10 03:28:10 +00:00
Drew Willcoxon
15f1e8095d Bug 1831971 - Remove zero-prefix functionality from the weather suggestion and don't start fetches until a config is set. r=daisuke
This fixes the bug by not starting fetches until a config is set from either
remote settings or Nimbus. By "config" I mean keywords basically, but we sync
more than keywords -- the min keyword length and min keyword length cap -- so
that's why I use different term. So, before remote settings is synced, no config
will be set, so no fetches will happen, so the suggestion will be null. When the
urlbar provider starts a query, it will see the suggestion is null and not add a
result. Once a config is set from RS or Nimbus, we'll start fetching.

Currently we allow zero prefix when keywords or the min keyword length aren't
set. This patch removes that functionality because on second thought, there's
not a safe and obvious way to support zero prefix using these keyword-related
config properties/variables by themselves, and zero prefix isn't a feature
requirement anymore anyway. If we wanted to keep supporting it with these
properties/variables, there are a few options, and I don't like any of them:

* If `keywords` is undefined or null, use zero prefix. This is dangerous because
  we may make a mistake in RS or Nimbus and forget to set it. Also, we use null
  as the default value for the Nimbus var, and since we use UrlbarPrefs to
  access Nimbus vars, there's no good way to tell whether null was set
  intentionally or not.
* If `keywords` is an empty array, use zero prefix. This is awkward because the
  user can now increment the min keyword length, which means the keywords array
  kept by `Weather` can become empty when the min keyword length is incremented
  a lot. In that case, no suggestion should be shown at all.
* If `min_keyword_length` is zero/falsey, use zero prefix. This has the same
  problems as the first point above.

If we do need to support zero prefix again in the future, I think we should add
an RS property/Nimbus variable that makes it clear what's happening, e.g., a
`useZeroPrefix` boolean.

I removed the exposure scalar because it's entirely based on zero prefix. We can
use Glean for that now anyway.

I also noticed weather suggestions are case insenstive, so I fixed that and
added a test task.

Differential Revision: https://phabricator.services.mozilla.com/D177448
2023-05-09 06:37:34 +00:00
Norisz Fay
170c5ddc71 Backed out changeset a39f9cd81a42 (bug 1831971) for causing bc failures on browser_glean_telemetry_engagement_selected_result.js CLOSED TREE 2023-05-09 09:14:25 +03:00
Drew Willcoxon
5b2c648c9e Bug 1831971 - Remove zero-prefix functionality from the weather suggestion and don't start fetches until a config is set. r=daisuke
This fixes the bug by not starting fetches until a config is set from either
remote settings or Nimbus. By "config" I mean keywords basically, but we sync
more than keywords -- the min keyword length and min keyword length cap -- so
that's why I use different term. So, before remote settings is synced, no config
will be set, so no fetches will happen, so the suggestion will be null. When the
urlbar provider starts a query, it will see the suggestion is null and not add a
result. Once a config is set from RS or Nimbus, we'll start fetching.

Currently we allow zero prefix when keywords or the min keyword length aren't
set. This patch removes that functionality because on second thought, there's
not a safe and obvious way to support zero prefix using these keyword-related
config properties/variables by themselves, and zero prefix isn't a feature
requirement anymore anyway. If we wanted to keep supporting it with these
properties/variables, there are a few options, and I don't like any of them:

* If `keywords` is undefined or null, use zero prefix. This is dangerous because
  we may make a mistake in RS or Nimbus and forget to set it. Also, we use null
  as the default value for the Nimbus var, and since we use UrlbarPrefs to
  access Nimbus vars, there's no good way to tell whether null was set
  intentionally or not.
* If `keywords` is an empty array, use zero prefix. This is awkward because the
  user can now increment the min keyword length, which means the keywords array
  kept by `Weather` can become empty when the min keyword length is incremented
  a lot. In that case, no suggestion should be shown at all.
* If `min_keyword_length` is zero/falsey, use zero prefix. This has the same
  problems as the first point above.

If we do need to support zero prefix again in the future, I think we should add
an RS property/Nimbus variable that makes it clear what's happening, e.g., a
`useZeroPrefix` boolean.

I removed the exposure scalar because it's entirely based on zero prefix. We can
use Glean for that now anyway.

I also noticed weather suggestions are case insenstive, so I fixed that and
added a test task.

Differential Revision: https://phabricator.services.mozilla.com/D177448
2023-05-09 04:28:47 +00:00
Drew Willcoxon
7a78f112c8 Bug 1831657 - Implement the "Show less frequently" weather suggestion command. r=daisuke
This increments the minimum keyword length when the user clicks the "Show less
frequently" command for the weather suggestion. It adds a pref to keep track of
the current min length. If the pref is zero, we use the min length in Nimbus or
remote settings.

There is a limit to the number of times "Show less frequently" can be clicked.
This patch calls it the cap. Once the cap is reached, the min length can't be
incremented any more and the command is not shown in the menu again. The cap can
be set in Nimbus and remote settings.

This patch also modifies UrlbarPrefs by making it possible to remove observers.
`Weather` needs to listen for changes to the `weather.minKeywordLength` pref,
and when the weather feature is disabled, it needs to stop listening.

Depends on D175827

Differential Revision: https://phabricator.services.mozilla.com/D177218
2023-05-08 09:08:43 +00:00
Drew Willcoxon
42a104c6fa Bug 1830385 - Implement the dismissal "Thanks for your feedback" message in Suggest results. r=dao,fluent-reviewers,flod
This implements the second "thanks for your feedback" UI for weather, Pocket,
addon, MDN, etc. suggestions. The first UI is in D175729, which this revision
builds on.

This UI is shown when a result is dismissed. It's essentially a tip with a
smaller icon and padding. It has the "Got it" button that dismisses the tip
itself when clicked.

I noticed tip top and bottom borders use `--panel-separator-color`, which
doesn't seem right. They're supposed to be the same color as the borders between
the input and view and between the results and one-off buttons, which is
`--autocomplete-popup-separator-color`. The spec for this feature uses the same
colors too. So I changed that too. (The use of `--panel-separator-color` goes
back to [the initial tip implementation](https://hg.mozilla.org/mozilla-central/rev/78886081d45b09987c1825cc5a160fd6bec61cb8) in 70, but search tips and
interventions weren't added until 74, in bug 1606909 and bug 1606917. I checked,
and in 74 all the borders are the same color.)

References:

* [Figma](https://www.figma.com/file/Hdi0oHB7trRcncyVAKZypO/accuweather-explorations?node-id=2421%3A62540&t=svOk7TxQv4V7Y9L4-1) (see "A11y review - user feedback" in sidebar)
* [Clickable prototype](https://www.figma.com/proto/Hdi0oHB7trRcncyVAKZypO/accuweather-explorations?page-id=2192%3A42825&node-id=2394-52468&viewport=246%2C526%2C0.12&scaling=min-zoom&starting-point-node-id=2394%3A52468&show-proto-sidebar=1) (see "Revised 4/3" in sidebar)
* [Content design](https://docs.google.com/document/d/1Mgt_oAIEDz_sF-YBqqUGtfKHQCAtRzEQohpfqk-2X8U/edit?usp=sharing)

Depends on D175729

Differential Revision: https://phabricator.services.mozilla.com/D176468
2023-05-02 20:15:18 +00:00
Norisz Fay
75705bdd6e Backed out changeset d09e87ed0a41 (bug 1830385) for causing xpcshell failures on test_weather.js CLOSED TREE 2023-05-02 22:05:41 +03:00
Drew Willcoxon
374c34715d Bug 1830385 - Implement the dismissal "Thanks for your feedback" message in Suggest results. r=dao,fluent-reviewers,flod
This implements the second "thanks for your feedback" UI for weather, Pocket,
addon, MDN, etc. suggestions. The first UI is in D175729, which this revision
builds on.

This UI is shown when a result is dismissed. It's essentially a tip with a
smaller icon and padding. It has the "Got it" button that dismisses the tip
itself when clicked.

I noticed tip top and bottom borders use `--panel-separator-color`, which
doesn't seem right. They're supposed to be the same color as the borders between
the input and view and between the results and one-off buttons, which is
`--autocomplete-popup-separator-color`. The spec for this feature uses the same
colors too. So I changed that too. (The use of `--panel-separator-color` goes
back to [the initial tip implementation](https://hg.mozilla.org/mozilla-central/rev/78886081d45b09987c1825cc5a160fd6bec61cb8) in 70, but search tips and
interventions weren't added until 74, in bug 1606909 and bug 1606917. I checked,
and in 74 all the borders are the same color.)

References:

* [Figma](https://www.figma.com/file/Hdi0oHB7trRcncyVAKZypO/accuweather-explorations?node-id=2421%3A62540&t=svOk7TxQv4V7Y9L4-1) (see "A11y review - user feedback" in sidebar)
* [Clickable prototype](https://www.figma.com/proto/Hdi0oHB7trRcncyVAKZypO/accuweather-explorations?page-id=2192%3A42825&node-id=2394-52468&viewport=246%2C526%2C0.12&scaling=min-zoom&starting-point-node-id=2394%3A52468&show-proto-sidebar=1) (see "Revised 4/3" in sidebar)
* [Content design](https://docs.google.com/document/d/1Mgt_oAIEDz_sF-YBqqUGtfKHQCAtRzEQohpfqk-2X8U/edit?usp=sharing)

Depends on D175729

Differential Revision: https://phabricator.services.mozilla.com/D176468
2023-05-02 16:50:43 +00:00
Drew Willcoxon
58bf4a148b Bug 1830383 - Implement "Thanks for your feedback" message in Suggest results. r=dao,fluent-reviewers,flod
This builds on D174994 and implements the "thanks for your feedback" message
shown inside a Suggest result when the user gives feedback on it without
dismissing it. This applies to weather suggestions, addons, Pocket, etc. The
implementation is very similar to the implementation of row/group labels.

References:

* [Figma](https://www.figma.com/file/Hdi0oHB7trRcncyVAKZypO/accuweather-explorations?node-id=2421%3A62540&t=svOk7TxQv4V7Y9L4-1) (see "A11y review - user feedback" in sidebar)
* [Clickable prototype](https://www.figma.com/proto/Hdi0oHB7trRcncyVAKZypO/accuweather-explorations?page-id=2192%3A42825&node-id=2394-52468&viewport=246%2C526%2C0.12&scaling=min-zoom&starting-point-node-id=2394%3A52468&show-proto-sidebar=1) (see "Revised 4/3" in sidebar)
* [Content design](https://docs.google.com/document/d/1Mgt_oAIEDz_sF-YBqqUGtfKHQCAtRzEQohpfqk-2X8U/edit?usp=sharing)

Depends on D174994

Differential Revision: https://phabricator.services.mozilla.com/D175729
2023-05-02 16:09:20 +00:00
Drew Willcoxon
b01dbca0d1 Bug 1828955 - Implement "Feedback" result menu button for weather suggestions. r=dao,bolsson
This makes the following changes to the result menu button for weather results:

* Add a "Feedback" label
* Make it always visible

We may want to use this feedback button for other types of results, so I added a
generalized way for results to opt into it, `result.showFeedbackMenu`.

See [Figma](https://www.figma.com/file/Hdi0oHB7trRcncyVAKZypO/accuweather-explorations?node-id=2421%3A62540&t=YUIAppzynd5ZmIew-1)

Differential Revision: https://phabricator.services.mozilla.com/D175922
2023-04-25 16:33:37 +00:00
Wil Stuckey
51509a8495 Bug 1819766 - Add support for exposure based experiments. r=adw
This change adds support for exposure based experiments by allowing
a Nimbus variable/pref to specify the urlbar provider that should
trigger an exposure event as well as a secondary boolean variable/pref
that controls the visibility of the exposed result. The exposure should
be registered when a result 'can be added' but may or may not be shown
based on the value of the `displayExposureProvider` variable.

* Add exposure event to metrics.yaml
* Add new Nimbus variable (`exposureProvider`) to specify the urlbar
  providers that should trigger exposure events .
* Add new Nimbus variable (`displayExposureProvider`) that controls the visibility
  of the provider results that matched the `exposureProvider` variable.

Differential Revision: https://phabricator.services.mozilla.com/D174209
2023-04-24 20:04:21 +00:00
Drew Willcoxon
ee150ed3ed Bug 1828960 - Don't remove the "open" attribute on the result menu button when a submenu closes. r=dao
Differential Revision: https://phabricator.services.mozilla.com/D175928
2023-04-20 18:32:21 +00:00
Drew Willcoxon
a449466edd Bug 1827943 - Implement the weather suggestion result menu UI. r=dao,fluent-reviewers,flod
This implements the weather suggestion result menu UI and builds on D174941.
References:

* [Spec]( https://www.figma.com/file/Hdi0oHB7trRcncyVAKZypO/accuweather-explorations?node-id=2421%3A62540&t=29w6wH3UYchqBxqX-1) (See "A11y review" in the sidebar)
* [Clickable prototype](https://www.figma.com/proto/Hdi0oHB7trRcncyVAKZypO/accuweather-explorations?page-id=2192%3A42825&node-id=2394-52468&viewport=246%2C526%2C0.12&scaling=min-zoom&starting-point-node-id=2394%3A52468&show-proto-sidebar=1) (See "Revised 4/3" in the sidebar)

There are a couple important points about the menu. First, one of the commands,
"Report inaccurate location", is specific to weather suggestions, or at least
location-based suggestions. I don't think it's a good idea to centralize all
commands in UrlbarView, and in general I'd like to stop centralizing handling of
different result types in the view and input, so I added a new provider method
called `getResultCommands()`.

Second, the spec calls for a menu separator and a submenu so the user can select
a reason they don't want to see the result, so the return value of
`getResultCommands()` is flexible enough to support those two things, and I
modified `#populateResultMenu()` too.

These new commands will be recorded in Glean engagement telemetry as new
`engagement_type` values, same as "dismiss" and "help" currently are.

This patch doesn't implement handling of two of the commands, "Report inaccurate
location" and "Show less frequently", because I wanted to keep it focused on the
fundamentals described above.

Depends on D174941

Differential Revision: https://phabricator.services.mozilla.com/D174994
2023-04-18 16:22:56 +00:00
Drew Willcoxon
c26ec9b3d6 Bug 1827762 - Replace UrlbarProvider.pickResult() and blockResult() with onEngagement() r=mak
This removes `UrlbarProvider.pickResult()` and `blockResult()` in favor of
handling picks and dismissals through `onEngagement()`. A number of providers
use those two methods, so this revision touches a lot of files.

Handling dismissals through `onEngagement()` means `UrlbarInput.pickResult()`
can no longer tell whether a result is successfully dismissed, so it can't
remove the result anymore. (Maybe `onEngagement()` could return some value
indicating it dismissed the result, but I don't want to go down that road.)
Instead, I split `UrlbarController.handleDeleteEntry()` into two methods: a
public one that removes the result and notifies listeners, and a private one
that handles dismissing the selected result internally in
UrlbarController. Providers that have dismissable results should now implement
`onEngagement()` and call `controller.removeResult()`.

I made some other improvements to engagement handling. There's still room for
more but this patch is big enough already.

Other notable changes:

Include the engaged result in engagement notifications so providers have easy
access to it and can respond to clicks and dismissals more easily. That also
lets us stop passing `selIndex` and `provider` to `engagementEvent.record()`
since now it can compute those from the passed-in result.

Add the concept of `isSessionOngoing` to engagement notifications so providers
can tell whether an engagement ended the search session. Right now, providers
like quick suggest that record a bunch of provider-specific legacy telemetry
assume that `onEngagement()` ends the session, but that's no longer true.

Unify result buttons and result menu commands by setting
`element.dataset.command` on buttons (hopefully we can remove buttons soon, at
least the ones that aren't tip buttons)

Make sure we always notify providers on engagement even on dismissals or
when skipping legacy telemetry

Move dismissal of restyled search suggestions and history results from
`UrlbarController.handleDeleteEntry()` to the Places provider

Move dismissal of form history results from
`UrlbarController.handleDeleteEntry()` to the search suggestions provider

In the Places provider, remove the unused `_addSearchEngineMatch()` method. Also
remove the code in the "searchengine" case that creates a non-search-history
result. This code is unreached because the only time the provider creates a
"searchengine" match it also sets `isSearchHistory` to true.

In `UrlbarTestUtils.promiseAutocompleteResultPopup()`, change the default value
of the `fireInputEvent` param from false to true. This is necessary because
without a starting input event, the start event info in `engagementEvent` will
be null, so when `engagementEvent.record()` is called at the end of the
engagement, it will bail, and providers will not be notified of the engagement.
IMO true is a better default value anyway because input events will typically be
fired when the user performs a search.

Differential Revision: https://phabricator.services.mozilla.com/D174941
2023-04-13 06:03:33 +00:00
James Teow
40ad3f14c3 Bug 1826884 - Don't show cached Top Picks if persisted search terms are present - r=adw
Differential Revision: https://phabricator.services.mozilla.com/D174929
2023-04-11 13:01:27 +00:00
Drew Willcoxon
9a44c7d51f Bug 1815686 - Clear the urlbar view before opening it after the window width changes. r=mak
This bug hits [this path](https://searchfox.org/mozilla-central/rev/3ba3d0a57b6419206f82f80cd6c30faf59397664/browser/components/urlbar/UrlbarView.sys.mjs#549-550) in `#autoOpen`, where it re-uses the current rows as
they exist. Overflow and underflow events aren't fired in that case, so the
`overflow` attribute isn't updated. The bug does not happen when the `else`
branch is hit because `onQueryResults()` clears the rows when the view isn't
open, and after that the rows are rebuilt.

This patch makes us hit the `else` path in this case by storing the width of the
input when the view is closed. If the stored width is different from the current
width, then the overflow state may be incorrect. Taking the `else` branch makes
us go through `onQueryResults()` and clear the rows before opening the view.

This fixes this bug and bug 1759857.

Differential Revision: https://phabricator.services.mozilla.com/D173596
2023-03-28 17:36:13 +00:00
Dão Gottwald
8b7b30f0a4 Bug 1790020 - Hook up urlbar result menu with telementry. r=mak
Differential Revision: https://phabricator.services.mozilla.com/D168688
2023-03-09 12:02:13 +00:00
Cristina Horotan
1255ede78b Backed out changeset fcc4aae881d7 (bug 1790020) for causing bc failures at browser_ext_urlbar.js CLOSED TREE 2023-03-09 13:11:26 +02:00
Dão Gottwald
4d726892e1 Bug 1790020 - Hook up urlbar result menu with telementry. r=mak
Differential Revision: https://phabricator.services.mozilla.com/D168688
2023-03-09 09:54:20 +00:00
Dale Harvey
e83e85de76 Bug 1819775 - Add icon for trending suggestions. r=adw
Differential Revision: https://phabricator.services.mozilla.com/D171404
2023-03-08 21:00:27 +00:00
Stanca Serban
0edec904ef Backed out changeset e7822e311e0c (bug 1790020) for causing mochitests failures in browser/components/urlbar/tests/browser-tips/browser_searchTips_interaction.js. CLOSED TREE 2023-03-08 17:40:26 +02:00
Dão Gottwald
42c66fc8dd Bug 1790020 - Hook up urlbar result menu with telementry. r=mak
Differential Revision: https://phabricator.services.mozilla.com/D168688
2023-03-08 14:22:31 +00:00
Dão Gottwald
27be2ac3d8 Bug 1816496 - Explicitly close result menu when closing the view. r=mak
Differential Revision: https://phabricator.services.mozilla.com/D171562
2023-03-03 17:20:20 +00:00
Dão Gottwald
081303df7d Bug 1818245 - Consolidate dynamic attribute setting code in UrlbarView. r=adw
Differential Revision: https://phabricator.services.mozilla.com/D170612
2023-02-24 07:16:56 +00:00
Dão Gottwald
1d64874fd4 Bug 1818455 - Fix selecting the result menu button by mouse with browser.urlbar.resultMenu.keyboardAccessible=false. r=mak
Differential Revision: https://phabricator.services.mozilla.com/D170736
2023-02-23 16:27:40 +00:00
Dão Gottwald
572c566454 Bug 1813517 - Add hidden pref for allowing Tab to skip over the menu button. r=mak
Differential Revision: https://phabricator.services.mozilla.com/D170267
2023-02-22 11:16:44 +00:00
Dão Gottwald
2b6f8f9442 Bug 1816496 - Listen to popuphiding event instead of seemingly unreliable popuphidden. r=NeilDeakin
Differential Revision: https://phabricator.services.mozilla.com/D169707
2023-02-17 16:50:38 +00:00
Dão Gottwald
0c23643ea2 Bug 1790022 - Add "Learn more" item to the urlbar result menu for history items. r=fluent-reviewers,flod,jteow
Differential Revision: https://phabricator.services.mozilla.com/D168816
2023-02-07 10:16:26 +00:00
Drew Willcoxon
5f9e3b5752 Bug 1814795 - Support keyword-based weather suggestions in addition to zero-prefix. r=daisuke
This adds a new pref, `browser.urlbar.weather.zeroPrefix`. When true, weather
suggestions are shown on "zero prefix" like they are now, which means they're
shown when the user focuses the urlbar and before they type anything. When the
pref is false, the weather provider will show suggestions only if the search
string matches a keyword in a set of keywords managed by `QuickSuggest.weather`.

My plan is to store the keywords in the quick suggest config object in remote
settings. Nan suggested this too. Currently the config does not contain any
keywords, but this patch can be tested by setting the pref to false, running the
following in the browser console, and then typing "weather" in the urlbar:

```lang=js
ChromeUtils.importESModule("resource:///modules/QuickSuggest.sys.mjs")
  .QuickSuggest.remoteSettings._test_setConfig({
    weather_keywords: ["weather"],
  });
```

Other changes:

* It's possible for a keyword to match both the weather suggestion and a quick
  suggest suggestion. Only the weather suggestion should be shown. This patch
  modifies to the muxer for that.
* This modifies `UrlbarView.#rowLabel()` to show the "Top pick" (a.k.a. best
  match) label for keyword-based weather suggestions, in addition to zero-prefix
  suggestions like we currently do.
* This modifies the remote settings client so it becomes enabled when keyword-
  based weather suggestions are enabled, so that the config can be accessed.

Depends on D168738

Differential Revision: https://phabricator.services.mozilla.com/D168757
2023-02-07 02:26:55 +00:00
Drew Willcoxon
9f4378e671 Bug 1814732 - Move weather suggestions to their own provider. r=daisuke
This moves weather suggestions from the quick suggest provider to their own
provider. This will make it easier to implement weather suggestions that are
triggered by keyword instead of being shown on zero-prefix.

It does the following:

* Copies UrlbarProviderQuickSuggest.sys.mjs to UrlbarProviderWeather.sys.mjs
* Removes everything weather-related from UrlbarProviderQuickSuggest.sys.mjs
* Removes everything not weather-related from UrlbarProviderWeather.sys.mjs
* Makes some simplifications to the new provider since it doesn't need to
  support quick suggest suggestions
* Removes `result.payload.isWeather` since now we can use `result.providerName`
* This does *not* change any telemetry

Differential Revision: https://phabricator.services.mozilla.com/D168738
2023-02-07 02:26:54 +00:00
Dão Gottwald
64875a0d74 Bug 1814828 - Handle clicks on result row border. r=adw
Differential Revision: https://phabricator.services.mozilla.com/D168794
2023-02-06 14:01:22 +00:00
Sandor Molnar
815e3f95d3 Backed out changeset 477317c7af48 (bug 1814828) for causing bc failuires browser/components/urlbar/tests/browser/browser_click_row_border.js CLOSED TREE 2023-02-03 19:59:24 +02:00
Dão Gottwald
c0cec5ef72 Bug 1814828 - Handle clicks on result row border. r=adw
Differential Revision: https://phabricator.services.mozilla.com/D168794
2023-02-03 17:04:14 +00:00
Dão Gottwald
a7c5be04f9 Bug 1814689 - Consolidate code handling UrlbarView overflowable elements. r=adw
Differential Revision: https://phabricator.services.mozilla.com/D168699
2023-02-03 10:25:39 +00:00
Dão Gottwald
f5ad5f7d00 Bug 1814656 - Fix typo. r=adw
Differential Revision: https://phabricator.services.mozilla.com/D168701
2023-02-03 03:15:38 +00:00
Dão Gottwald
fa7b554ee2 Bug 1801389 - SPACE should open the result menu when the button is selected. r=mak,Jamie
Differential Revision: https://phabricator.services.mozilla.com/D168522
2023-02-03 03:11:20 +00:00
mcheang
f26d2a59ce Bug 1811556 - Fix text fading in weather suggestion result and hide middot when high and low temperatures are wrapped. r=adw
Differential Revision: https://phabricator.services.mozilla.com/D167416
2023-02-01 13:52:57 +00:00
Dão Gottwald
d7994183f4 Bug 1811507 - Fix highlighting of dynamic type rows. r=adw
Differential Revision: https://phabricator.services.mozilla.com/D167795
2023-01-27 19:21:10 +00:00
James Teow
b90a51d87e Bug 1812261 - Prevent search tip from flashing when re-opening urlbar - r=adw
Differential Revision: https://phabricator.services.mozilla.com/D167895
2023-01-27 02:05:33 +00:00
Dão Gottwald
b7b01928c9 Bug 1812677 - Disable result menu for autofill results. r=adw
The result menu is currently available (but broken) for autofill results due to bug 1810113. Until that's done or the menu gets fixed (bug 1790028), we should disable the menu for these results.

Differential Revision: https://phabricator.services.mozilla.com/D167980
2023-01-26 20:16:33 +00:00
Daisuke Akatsuka
5e04583fb5 Bug 1791657: Show page title if it is in places. r=adw,mak
Depends on D159243

Differential Revision: https://phabricator.services.mozilla.com/D157891
2023-01-24 22:35:15 +00:00
Daisuke Akatsuka
d46b22b675 Bug 1791657: Introduce fallbackTitle into payload. r=adw
Differential Revision: https://phabricator.services.mozilla.com/D159243
2023-01-24 22:35:14 +00:00
Drew Willcoxon
c81b3fa8ae Bug 1811373 - Cache weather suggestion l10n strings and allow L10nCache to cache strings only by ID. r=dao
This caches weather suggestion l10n strings by adding `cacheable: true` to the
view update object returned by the provider. Doing so hooks into UrlbarView's
dynamic result type functionality [here](https://searchfox.org/mozilla-central/rev/738b761bb2847f609f9cacc550680071cdc53637/browser/components/urlbar/UrlbarView.sys.mjs#1737-1739).

w/r/t l10n strings and caching, weather suggestions are a bit of a new case
because most of these strings take arguments that can't be known in advance and
that will change over time. For a string with arguments, L10nCache creates a
cache key by concating the string's ID and the values of its arguments. That
makes sense for strings whose values are things like search engine names, where
the set of possible argument values is small and where we may need to show
different translated strings when for example the search engine changes. For
those strings, we want to cache the translated strings separately using
different keys.

Weather suggestion strings like "20°C" are a different story. The ideal UX for
these strings is: While the UI is waiting for the string to be re-localized with
new argument values, it should show the previous localized string with the old
argument values. If the argument values have changed, there will still be some
flicker as the old values are replaced with the new ones, but it's the best we
can do, and at least there won't be empty space in the UI.

This isn't possible with L10nCache right now due to how it creates cache keys,
as mentioned earlier. So I added a new option that tells it to cache strings by
ID only, excluding argument values. That way only one translated string is
cached regardless of whatever argument values it was cached with.

Differential Revision: https://phabricator.services.mozilla.com/D167318
2023-01-23 17:49:55 +00:00