author | Drew Willcoxon <adw@mozilla.com> |
Mon, 23 Aug 2021 19:47:16 +0000 (2021-08-23) | |
changeset 589610 | 7b4db2f1bf8f241eb9b4be4554d151331516a5ac |
parent 589609 | 931a7c66c02f67e70d1eb0634f49bf1efb874ae3 |
child 589611 | 2f684ad432581dcc0f03705769cc222aef621c95 |
push id | 38729 |
push user | csabou@mozilla.com |
push date | Tue, 24 Aug 2021 03:18:22 +0000 (2021-08-24) |
treeherder | mozilla-central@54e7fb66ad44 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | harry, fluent-reviewers, preferences-reviewers, flod |
bugs | 1709511 |
milestone | 93.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/browser/base/content/browser.xhtml +++ b/browser/base/content/browser.xhtml @@ -74,16 +74,17 @@ <link rel="localization" href="browser/protectionsPanel.ftl"/> <link rel="localization" href="browser/appmenu.ftl"/> <link rel="localization" href="preview/interventions.ftl"/> <link rel="localization" href="browser/sidebarMenu.ftl"/> <link rel="localization" href="browser/allTabsMenu.ftl"/> <link rel="localization" href="browser/places.ftl"/> <link rel="localization" href="toolkit/printing/printUI.ftl"/> <link rel="localization" href="browser/tabbrowser.ftl"/> + <link rel="localization" href="preview/firefoxSuggest.ftl"/> <title data-l10n-id="browser-main-window-title"></title> # All JS files which are needed by browser.xhtml and other top level windows to # support MacOS specific features *must* go into the global-scripts.inc file so # that they can be shared with macWindow.inc.xhtml. #include global-scripts.inc
--- a/browser/components/preferences/preferences.xhtml +++ b/browser/components/preferences/preferences.xhtml @@ -48,16 +48,17 @@ <link rel="localization" href="browser/preferences/permissions.ftl"/> <link rel="localization" href="browser/preferences/selectBookmark.ftl"/> <link rel="localization" href="browser/preferences/siteDataSettings.ftl"/> <link rel="localization" href="browser/aboutDialog.ftl"/> <link rel="localization" href="browser/sanitize.ftl"/> <link rel="localization" href="toolkit/updates/history.ftl"/> <link rel="localization" href="security/certificates/deviceManager.ftl"/> <link rel="localization" href="security/certificates/certManager.ftl"/> + <link rel="localization" href="preview/firefoxSuggest.ftl"/> <link rel="shortcut icon" href="chrome://global/skin/icons/settings.svg"/> <script src="chrome://browser/content/utilityOverlay.js"/> <script src="chrome://global/content/preferencesBindings.js"/> <script src="chrome://browser/content/preferences/preferences.js"/> <script src="chrome://browser/content/preferences/extensionControlled.js"/> <script src="chrome://browser/content/preferences/findInPage.js"/>
--- a/browser/components/preferences/search.inc.xhtml +++ b/browser/components/preferences/search.inc.xhtml @@ -58,26 +58,26 @@ <checkbox id="suggestionsInSearchFieldsCheckbox" data-l10n-id="search-suggestions-option" preference="browser.search.suggest.enabled"/> <vbox class="indent"> <checkbox id="urlBarSuggestion" data-l10n-id="search-show-suggestions-url-bar-option" /> <checkbox id="showSearchSuggestionsFirstCheckbox" data-l10n-id="search-show-suggestions-above-history-option" preference="browser.urlbar.showSearchSuggestionsFirst"/> - <!-- This box is visible only for users enrolled in the en-US Quick Suggest experiment. --> + <!-- #showQuickSuggestContainer is visible only for users enrolled in Firefox Suggest experiments. --> <hbox id="showQuickSuggestContainer" data-subcategory="quickSuggest" align="center" hidden="true"> <checkbox id="showQuickSuggest" class="tail-with-learn-more" - label="Show Firefox Suggest in the address bar (suggested and sponsored results)" + data-l10n-id="firefox-suggest-preferences-enable-urlbar-results" preference="browser.urlbar.suggest.quicksuggest"/> <label id="showQuickSuggestLearnMore" class="learnMore" is="text-link" - value="Learn more about Firefox Suggest"/> + data-l10n-id="firefox-suggest-preferences-enable-urlbar-results-learn-more"/> </hbox> <checkbox id="showSearchSuggestionsPrivateWindows" data-l10n-id="search-show-suggestions-private-windows"/> <hbox id="urlBarSuggestionPermanentPBLabel" align="center" class="indent"> <label flex="1" data-l10n-id="search-suggestions-cant-show" /> </hbox> </vbox>
--- a/browser/components/urlbar/UrlbarProviderQuickSuggest.jsm +++ b/browser/components/urlbar/UrlbarProviderQuickSuggest.jsm @@ -21,20 +21,16 @@ XPCOMUtils.defineLazyModuleGetters(this, UrlbarProvider: "resource:///modules/UrlbarUtils.jsm", UrlbarResult: "resource:///modules/UrlbarResult.jsm", UrlbarUtils: "resource:///modules/UrlbarUtils.jsm", }); // These prefs are relative to the `browser.urlbar` branch. const SUGGEST_PREF = "suggest.quicksuggest"; -const FEATURE_NAME = "Firefox Suggest"; -const NONSPONSORED_ACTION_TEXT = FEATURE_NAME; -const HELP_TITLE = `Learn more about ${FEATURE_NAME}`; - const TELEMETRY_SCALAR_IMPRESSION = "contextual.services.quicksuggest.impression"; const TELEMETRY_SCALAR_CLICK = "contextual.services.quicksuggest.click"; const TELEMETRY_SCALAR_HELP = "contextual.services.quicksuggest.help"; const TELEMETRY_EVENT_CATEGORY = "contextservices.quicksuggest"; /** @@ -60,24 +56,16 @@ class ProviderQuickSuggest extends Urlba /** * The type of the provider. */ get type() { return UrlbarUtils.PROVIDER_TYPE.NETWORK; } /** - * @returns {string} The name of the Firefox Suggest feature, suitable for - * display to the user. en-US only for now. - */ - get featureName() { - return FEATURE_NAME; - } - - /** * @returns {string} The help URL for the Quick Suggest feature. */ get helpUrl() { return ( this._helpUrl || Services.urlFormatter.formatURLPref("app.support.baseURL") + "firefox-suggest" ); @@ -138,21 +126,21 @@ class ProviderQuickSuggest extends Urlba url: suggestion.url, icon: suggestion.icon, sponsoredImpressionUrl: suggestion.impression_url, sponsoredClickUrl: suggestion.click_url, sponsoredBlockId: suggestion.block_id, sponsoredAdvertiser: suggestion.advertiser, isSponsored: true, helpUrl: this.helpUrl, - helpTitle: HELP_TITLE, + helpL10nId: "firefox-suggest-urlbar-learn-more", }; if (!suggestion.isSponsored) { - payload.sponsoredText = NONSPONSORED_ACTION_TEXT; + payload.sponsoredL10nId = "firefox-suggest-urlbar-nonsponsored-action"; } let result = new UrlbarResult( UrlbarUtils.RESULT_TYPE.URL, UrlbarUtils.RESULT_SOURCE.SEARCH, ...UrlbarResult.payloadAndSimpleHighlights(queryContext.tokens, payload) ); result.isSuggestedIndexRelativeToGroup = true;
--- a/browser/components/urlbar/UrlbarUtils.jsm +++ b/browser/components/urlbar/UrlbarUtils.jsm @@ -1286,19 +1286,16 @@ UrlbarUtils.RESULT_PAYLOAD_SCHEMA = { required: ["url"], properties: { displayUrl: { type: "string", }, helpL10nId: { type: "string", }, - helpTitle: { - type: "string", - }, helpUrl: { type: "string", }, icon: { type: "string", }, isPinned: { type: "boolean", @@ -1319,17 +1316,17 @@ UrlbarUtils.RESULT_PAYLOAD_SCHEMA = { type: "number", }, sponsoredClickUrl: { type: "string", }, sponsoredImpressionUrl: { type: "string", }, - sponsoredText: { + sponsoredL10nId: { type: "string", }, sponsoredTileId: { type: "number", }, tags: { type: "array", items: {
--- a/browser/components/urlbar/UrlbarView.jsm +++ b/browser/components/urlbar/UrlbarView.jsm @@ -1147,22 +1147,16 @@ class UrlbarView { // button if the result will use it. if (result.payload.helpUrl) { let helpButton = this._createElement("span"); helpButton.className = "urlbarView-help"; helpButton.setAttribute("role", "button"); if (result.payload.helpL10nId) { helpButton.setAttribute("data-l10n-id", result.payload.helpL10nId); } - if (result.payload.helpTitle) { - // Allow the payload to specify the title text directly. Normally - // `helpL10nId` should be used instead, but `helpTitle` is useful for - // experiments with hardcoded user-facing strings. - helpButton.setAttribute("title", result.payload.helpTitle); - } item.appendChild(helpButton); item._elements.set("helpButton", helpButton); item._content.setAttribute("selectable", "true"); // Remove role=option on the row and set it on row-inner since the latter // is the selectable logical row element when the help button is present. // Since row-inner is not a child of the role=listbox element (the row // container, this._rows), screen readers will not automatically recognize @@ -1453,20 +1447,23 @@ class UrlbarView { item.removeAttribute("pinned"); } if ( result.payload.isSponsored && result.type != UrlbarUtils.RESULT_TYPE.TAB_SWITCH ) { item.toggleAttribute("sponsored", true); - if (result.payload.sponsoredText) { - action.removeAttribute("data-l10n-id"); - actionSetter = () => - (action.textContent = result.payload.sponsoredText); + if (result.payload.sponsoredL10nId) { + actionSetter = () => { + this.document.l10n.setAttributes( + action, + result.payload.sponsoredL10nId + ); + }; } else { actionSetter = () => { this.document.l10n.setAttributes( action, "urlbar-result-action-sponsored" ); }; }
new file mode 100644 --- /dev/null +++ b/browser/components/urlbar/content/firefoxSuggest.ftl @@ -0,0 +1,32 @@ +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +### These strings are related to the Firefox Suggest feature. Firefox Suggest +### shows recommended and sponsored third-party results in the address bar +### panel. It also shows headings/labels above different groups of results. For +### example, a "Firefox Suggest" label is shown above bookmarks and history +### results, and an "{ $engine } Suggestions" label may be shown above search +### suggestion results. + +## These strings are used in the urlbar panel. + +# Action text shown in Firefox Suggest urlbar results, appended after the result +# title like "Result Title - Action Text". Used for Firefox Suggest results that +# are non-sponsored. +firefox-suggest-urlbar-nonsponsored-action = { -firefox-suggest-brand-name } + +# Tooltip text for the help button shown in Firefox Suggest urlbar results. +firefox-suggest-urlbar-learn-more = + .title = Learn more about { -firefox-suggest-brand-name } + +## These strings are used in the preferences UI (about:preferences). + +# Label for the checkbox that controls whether Firefox Suggest results in the +# urlbar are enabled. +firefox-suggest-preferences-enable-urlbar-results = + .label = Show { -firefox-suggest-brand-name } in the address bar (suggested and sponsored results) + +# Learn-more link text for the checkbox. +firefox-suggest-preferences-enable-urlbar-results-learn-more = + .value = Learn more about { -firefox-suggest-brand-name }
--- a/browser/components/urlbar/tests/browser/browser_helpUrl.js +++ b/browser/components/urlbar/tests/browser/browser_helpUrl.js @@ -43,42 +43,16 @@ add_task(async function title_helpL10nId { id: helpL10nId, args: null }, "The l10n ID attribute was correctly set" ); await UrlbarTestUtils.promisePopupClose(window); UrlbarProvidersManager.unregisterProvider(provider); }); -// Sets `helpTitle` on the result payload and makes sure the help button ends up -// with a corresponding title attribute. -add_task(async function title_helpTitle() { - let helpTitle = "Example help title"; - let provider = registerTestProvider(1, { helpTitle }); - await UrlbarTestUtils.promiseAutocompleteResultPopup({ - value: "example", - window, - }); - - await assertIsTestResult(1); - - let result = await UrlbarTestUtils.getDetailsOfResultAt(window, 1); - let helpButton = result.element.row._elements.get("helpButton"); - Assert.ok(helpButton, "Sanity check: help button should exist"); - - Assert.deepEqual( - helpButton.getAttribute("title"), - helpTitle, - "The title attribute was correctly set" - ); - - await UrlbarTestUtils.promisePopupClose(window); - UrlbarProvidersManager.unregisterProvider(provider); -}); - // Arrows up and down through a result with a help button. The result is the // second result and has other results after it. add_task(async function keyboardSelection_secondResult() { let provider = registerTestProvider(1); await UrlbarTestUtils.promiseAutocompleteResultPopup({ value: "example", window, });
--- a/browser/locales/jar.mn +++ b/browser/locales/jar.mn @@ -6,16 +6,17 @@ # Note: This file should only contain locale entries. All # override and resource entries should go to browser/base/jar.mn to avoid # having to create the same entry for each locale. [localization] @AB_CD@.jar: preview/ion.ftl (../components/ion/content/ion.ftl) preview/protections.ftl (../components/protections/content/protections.ftl) preview/interventions.ftl (../components/urlbar/content/interventions.ftl) + preview/firefoxSuggest.ftl (../components/urlbar/content/firefoxSuggest.ftl) browser (%browser/**/*.ftl) @AB_CD@.jar: % locale browser @AB_CD@ %locale/browser/ # bookmarks.html is produced by LOCALIZED_GENERATED_FILES. locale/browser/bookmarks.html (bookmarks.html) locale/browser/accounts.properties (%chrome/browser/accounts.properties)