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
This commit is contained in:
Drew Willcoxon 2021-03-03 00:48:01 +00:00
parent c053874093
commit 14eefa1933
5 changed files with 26 additions and 12 deletions

View File

@ -332,10 +332,6 @@ pref("browser.urlbar.suggest.quicksuggest", true);
// Whether the QuickSuggest experiment is enabled.
pref("browser.urlbar.quicksuggest.enabled", false);
// The URL for clicks on QuickSuggest help buttons and learn-more links.
// TODO (bug 1693671): Replace this URL with the final URL of the blog post.
pref("browser.urlbar.quicksuggest.helpURL", "https://www.mozilla.org/");
// How many times to show the QuickSuggest onboarding help button.
pref("browser.urlbar.quicksuggest.onboardingCount", 0);
pref("browser.urlbar.quicksuggest.onboardingMaxCount", 5);

View File

@ -26,6 +26,11 @@ ChromeUtils.defineModuleGetter(
"resource:///modules/UrlbarUtils.jsm"
);
XPCOMUtils.defineLazyModuleGetters(this, {
UrlbarProviderQuickSuggest:
"resource:///modules/UrlbarProviderQuickSuggest.jsm",
});
Preferences.addAll([
{ id: "browser.search.suggest.enabled", type: "bool" },
{ id: "browser.urlbar.suggest.searches", type: "bool" },
@ -261,7 +266,7 @@ var gSearchPane = {
// The experiment is enabled.
document
.getElementById("showQuickSuggestLearnMore")
.setAttribute("href", UrlbarPrefs.get("quicksuggest.helpURL"));
.setAttribute("href", UrlbarProviderQuickSuggest.helpUrl);
container.removeAttribute("hidden");
if (desc.dataset.l10nId) {
desc.dataset.l10nIdOriginal = desc.dataset.l10nId;

View File

@ -168,11 +168,6 @@ const PREF_URLBAR_DEFAULTS = new Map([
// Whether the QuickSuggest experiment is enabled.
["quicksuggest.enabled", false],
// The URL for clicks on QuickSuggest help buttons and learn-more links.
// TODO (bug 1693671): Replace this URL with the final URL of the blog post,
// and don't forget to update firefox.js.
["quicksuggest.helpURL", "https://www.mozilla.org/"],
// The number of times the onboarding help button has been shown in
// QuickSuggest results.
["quicksuggest.onboardingCount", 0],

View File

@ -64,6 +64,17 @@ class ProviderQuickSuggest extends UrlbarProvider {
return UrlbarUtils.PROVIDER_TYPE.NETWORK;
}
/**
* @returns {string} The help URL for the Quick Suggest feature.
*/
get helpUrl() {
return (
this._helpUrl ||
Services.urlFormatter.formatURLPref("app.support.baseURL") +
"sponsored-search"
);
}
/**
* Whether this provider should be invoked for the given context.
* If this method returns false, the providers manager won't start a query
@ -130,7 +141,7 @@ class ProviderQuickSuggest extends UrlbarProvider {
// Show the help button if we haven't reached the max onboarding count yet.
if (this._onboardingCount < this._onboardingMaxCount) {
payload.helpUrl = UrlbarPrefs.get("quicksuggest.helpURL");
payload.helpUrl = this.helpUrl;
payload.helpTitle = ONBOARDING_TEXT;
}
@ -295,6 +306,9 @@ class ProviderQuickSuggest extends UrlbarProvider {
// Whether we added a result during the most recent query.
_addedResultInLastQuery = false;
// This is intended for tests and allows them to set a different help URL.
_helpUrl = undefined;
get _onboardingCount() {
return UrlbarPrefs.get(ONBOARDING_COUNT_PREF);
}

View File

@ -11,6 +11,8 @@ XPCOMUtils.defineLazyModuleGetters(this, {
CONTEXTUAL_SERVICES_PING_TYPES:
"resource:///modules/PartnerLinkAttribution.jsm",
PartnerLinkAttribution: "resource:///modules/PartnerLinkAttribution.jsm",
UrlbarProviderQuickSuggest:
"resource:///modules/UrlbarProviderQuickSuggest.jsm",
UrlbarQuickSuggest: "resource:///modules/UrlbarQuickSuggest.jsm",
});
@ -59,7 +61,6 @@ add_task(async function init() {
await SpecialPowers.pushPrefEnv({
set: [
[EXPERIMENT_PREF, true],
["browser.urlbar.quicksuggest.helpURL", TEST_HELP_URL],
["browser.urlbar.suggest.searches", true],
],
});
@ -75,6 +76,8 @@ add_task(async function init() {
await UrlbarQuickSuggest.init();
await UrlbarQuickSuggest._processSuggestionsJSON(TEST_DATA);
UrlbarProviderQuickSuggest._helpUrl = TEST_HELP_URL;
// Enable local telemetry recording for the duration of the test.
let oldCanRecord = Services.telemetry.canRecordExtended;
Services.telemetry.canRecordExtended = true;
@ -86,6 +89,7 @@ add_task(async function init() {
Services.search.setDefault(oldDefaultEngine);
await Services.search.removeEngine(engine);
Services.telemetry.canRecordExtended = oldCanRecord;
delete UrlbarProviderQuickSuggest._helpUrl;
});
});