From 15bb63ab9271f3939b1bcdbe48243893c2e8b40f Mon Sep 17 00:00:00 2001 From: Gregory Pappas Date: Tue, 31 Jan 2023 18:50:23 +0000 Subject: [PATCH] Bug 1813302 - Add missing blockL10n property to UrlbarProviderOmnibox payload r=dao,adw Differential Revision: https://phabricator.services.mozilla.com/D168191 --- .../urlbar/UrlbarProviderOmnibox.sys.mjs | 1 + browser/components/urlbar/UrlbarUtils.sys.mjs | 12 ++++++++++++ browser/components/urlbar/tests/unit/head.js | 17 +++++++++++------ 3 files changed, 24 insertions(+), 6 deletions(-) diff --git a/browser/components/urlbar/UrlbarProviderOmnibox.sys.mjs b/browser/components/urlbar/UrlbarProviderOmnibox.sys.mjs index c63f18f0b732..114bd4d75cf3 100644 --- a/browser/components/urlbar/UrlbarProviderOmnibox.sys.mjs +++ b/browser/components/urlbar/UrlbarProviderOmnibox.sys.mjs @@ -179,6 +179,7 @@ class ProviderOmnibox extends UrlbarProvider { queryContext.tokens[0].value, UrlbarUtils.HIGHLIGHT.TYPED, ], + blockL10n: { id: "urlbar-result-menu-dismiss-firefox-suggest" }, isBlockable: suggestion.deletable, icon: UrlbarUtils.ICON.EXTENSION, } diff --git a/browser/components/urlbar/UrlbarUtils.sys.mjs b/browser/components/urlbar/UrlbarUtils.sys.mjs index 15e4e6e17599..c0c0da774557 100644 --- a/browser/components/urlbar/UrlbarUtils.sys.mjs +++ b/browser/components/urlbar/UrlbarUtils.sys.mjs @@ -1655,6 +1655,18 @@ UrlbarUtils.RESULT_PAYLOAD_SCHEMA = { type: "object", required: ["keyword"], properties: { + blockL10n: { + type: "object", + required: ["id"], + properties: { + id: { + type: "string", + }, + args: { + type: "array", + }, + }, + }, content: { type: "string", }, diff --git a/browser/components/urlbar/tests/unit/head.js b/browser/components/urlbar/tests/unit/head.js index 23f9af5b90f5..720a152348ce 100644 --- a/browser/components/urlbar/tests/unit/head.js +++ b/browser/components/urlbar/tests/unit/head.js @@ -506,17 +506,22 @@ function makeOmniboxResult( queryContext, { content, description, keyword, heuristic = false } ) { + let payload = { + title: [description, UrlbarUtils.HIGHLIGHT.TYPED], + content: [content, UrlbarUtils.HIGHLIGHT.TYPED], + keyword: [keyword, UrlbarUtils.HIGHLIGHT.TYPED], + icon: [UrlbarUtils.ICON.EXTENSION], + }; + if (!heuristic) { + payload.blockL10n = { id: "urlbar-result-menu-dismiss-firefox-suggest" }; + } let result = new UrlbarResult( UrlbarUtils.RESULT_TYPE.OMNIBOX, UrlbarUtils.RESULT_SOURCE.ADDON, - ...UrlbarResult.payloadAndSimpleHighlights(queryContext.tokens, { - title: [description, UrlbarUtils.HIGHLIGHT.TYPED], - content: [content, UrlbarUtils.HIGHLIGHT.TYPED], - keyword: [keyword, UrlbarUtils.HIGHLIGHT.TYPED], - icon: [UrlbarUtils.ICON.EXTENSION], - }) + ...UrlbarResult.payloadAndSimpleHighlights(queryContext.tokens, payload) ); result.heuristic = heuristic; + return result; }