Closed Bug 1814795 Opened 2 years ago Closed 2 years ago

Support keyword-based weather suggestions in addition to zero-prefix

Categories

(Firefox :: Address Bar, task, P2)

task

Tracking

()

VERIFIED FIXED
111 Branch
Tracking Status
firefox111 --- verified

People

(Reporter: adw, Assigned: adw)

References

Details

Attachments

(1 file)

Per product requirements, we need to support keyword-based weather suggestions, i.e., suggestions that are shown when the user types certain weather-related keywords.

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:

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

Pushed by dwillcoxon@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/e64985540747 Support keyword-based weather suggestions in addition to zero-prefix. r=daisuke
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 111 Branch

STR:

  1. Enable zero-prefix weather suggestions by setting these prefs:
    browser.urlbar.quicksuggest.enabled = true
    browser.urlbar.weather.featureGate = true
    
  2. Click in the urlbar and verify a weather suggestion appears (if it doesn't, give Firefox a few seconds to fetch it and try again)
  3. Enable keyword-based weather suggestions: Set browser.urlbar.weather.zeroPrefix to false, and open the browser console and run the following JS:
    ChromeUtils.importESModule("resource:///modules/QuickSuggest.sys.mjs")
      .QuickSuggest.remoteSettings._test_setConfig({
        weather_keywords: ["weather"],
      });
    
  4. Click in the urlbar and verify a weather suggestion does not appear (it might appear for a split second right after the panel opens, that's expected, but it should go away and not reappear)
  5. Type "weather" and verify it does appear
Flags: qe-verify+
Flags: in-testsuite+

I have verified this task on the latest Firefox Nightly 111.0a1 (Build ID: 20230209041032) on Windows 10 x64, macOS 12.6.1, and Ubuntu 20.04 x64.

  • The Weather result is displayed when clicking inside the Address Bar if the browser.urlbar.weather.zeroPrefix pref is true.
  • After setting the browser.urlbar.weather.zeroPrefix pref to false, the Weather result is displayed when the snippet from step 3, comment 4 is ran, and the weather keyword is typed in the Address Bar. The Weather result is no longer triggered with just clicking inside the Address Bar.
Status: RESOLVED → VERIFIED
Flags: qe-verify+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: