commit 978b39e0aa558d820668aece8ed5aac593a94ff6 parent 9406c58887da69dffe628cde41d3da9dc19f6da2 Author: Daisuke Akatsuka <daisuke@birchill.co.jp> Date: Thu, 11 Dec 2025 01:12:05 +0000 Bug 1995227: Stop payload pre calculation r=adw Differential Revision: https://phabricator.services.mozilla.com/D274838 Diffstat:
8 files changed, 17 insertions(+), 32 deletions(-)
diff --git a/browser/components/urlbar/UrlbarResult.sys.mjs b/browser/components/urlbar/UrlbarResult.sys.mjs @@ -463,30 +463,6 @@ export class UrlbarResult { tokens, highlightTargets, }) { - if ( - !payload.title && - !payload.fallbackTitle && - payload.url && - typeof payload.url == "string" - ) { - // If there's no title, show the domain as the title. Not all valid URLs - // have a domain. - try { - payload.title = new URL(payload.url).URI.displayHostPort; - highlightTargets.title = lazy.UrlbarUtils.HIGHLIGHT.TYPED; - } catch (e) {} - } - - // For performance reasons limit excessive string lengths, to reduce the - // amount of string matching we do here, and avoid wasting resources to - // handle long textruns that the user would never see anyway. - for (let prop of ["title", "suggestion"]) { - let value = payload[prop]; - if (typeof value == "string") { - payload[prop] = value.substring(0, lazy.UrlbarUtils.MAX_TEXT_LENGTH); - } - } - if (!tokens?.length) { return; } diff --git a/browser/components/urlbar/tests/browser/browser_results_format_displayValue.js b/browser/components/urlbar/tests/browser/browser_results_format_displayValue.js @@ -49,7 +49,7 @@ add_task(async function test_receive_punycode_result() { "Result is trimmed and formatted correctly." ); is( - row.result.payload.title, + row.result.getDisplayableValueAndHighlights("title").value, "www.اختبار.اختبار.org:5000", "Result is trimmed and formatted correctly." ); diff --git a/browser/components/urlbar/tests/quicksuggest/unit/test_quicksuggest_merino.js b/browser/components/urlbar/tests/quicksuggest/unit/test_quicksuggest_merino.js @@ -690,7 +690,6 @@ add_task(async function dismissals_unmanaged_1() { heuristic: false, payload: { provider, - title: "example.com", url: suggestion.url, originalUrl: suggestion.original_url, dismissalKey: suggestion.dismissal_key, @@ -811,7 +810,6 @@ add_task(async function dismissals_unmanaged_2() { heuristic: false, payload: { provider, - title: "example.com", url: "https://example.com/url", source: "merino", isSponsored: false, diff --git a/browser/components/urlbar/tests/unit/head.js b/browser/components/urlbar/tests/unit/head.js @@ -430,7 +430,7 @@ async function cleanupPlaces() { * The context that this result will be displayed in. * @param {object} options * Options for the result. - * @param {string} options.title + * @param {string} [options.title] * The page title. * @param {string} options.uri * The page URI. @@ -898,7 +898,7 @@ function makeVisitResult( url: uri, }; - if (title) { + if (title != undefined) { payload.title = title; } diff --git a/browser/components/urlbar/tests/unit/test_autofill_origins.js b/browser/components/urlbar/tests/unit/test_autofill_origins.js @@ -967,7 +967,7 @@ add_task(async function domainTitle() { }), makeVisitResult(context, { uri: "https://www.example.com/", - title: "www.example.com", + title: "", }), ], }, diff --git a/browser/components/urlbar/tests/unit/test_autofill_prefix_fallback.js b/browser/components/urlbar/tests/unit/test_autofill_prefix_fallback.js @@ -40,7 +40,8 @@ add_task(async function () { }), makeBookmarkResult(context, { uri: `https://${host}/`, - title: `${host}`, + // This empty title is set in UrlbarProviderPlaces + title: "", }), ], }); @@ -69,7 +70,8 @@ add_task(async function () { }), makeBookmarkResult(context, { uri: `https://www.${host}/`, - title: `www.${host}`, + // This empty title is set in UrlbarProviderPlaces + title: "", }), ], }); diff --git a/browser/components/urlbar/tests/unit/test_providerHeuristicFallback.js b/browser/components/urlbar/tests/unit/test_providerHeuristicFallback.js @@ -761,6 +761,7 @@ add_task(async function () { makeVisitResult(context, { source: UrlbarUtils.RESULT_SOURCE.HISTORY, uri: `http://test.xn--e1afmkfd.com/`, + title: "test.пример.com", heuristic: true, iconUri: "page-icon:http://test.xn--e1afmkfd.com/", }), diff --git a/browser/components/urlbar/tests/unit/test_provider_notification.js b/browser/components/urlbar/tests/unit/test_provider_notification.js @@ -65,6 +65,7 @@ add_task(async function testOnEngagementNotification() { const engagedResult = makeVisitResult(context, { uri: "https://mozilla.com/", + title: "mozilla.com", providerName: "firstProvider", source: UrlbarUtils.RESULT_SOURCE.OTHER_LOCAL, }); @@ -75,6 +76,7 @@ add_task(async function testOnEngagementNotification() { engagedResult, makeVisitResult(context, { uri: "https://example.com/", + title: "example.com", providerName: "secondProvider", source: UrlbarUtils.RESULT_SOURCE.OTHER_LOCAL, }), @@ -112,11 +114,13 @@ add_task(async function testOnAbandonmentNotification() { matches: [ makeVisitResult(context, { uri: "https://mozilla.com/", + title: "mozilla.com", providerName: "firstProvider", source: UrlbarUtils.RESULT_SOURCE.OTHER_LOCAL, }), makeVisitResult(context, { uri: "https://example.com/", + title: "example.com", providerName: "secondProvider", source: UrlbarUtils.RESULT_SOURCE.OTHER_LOCAL, }), @@ -149,6 +153,7 @@ add_task(async function testOnImpressionNotification() { const engagedResult = makeVisitResult(context, { uri: "https://mozilla.com/", + title: "mozilla.com", providerName: "firstProvider", source: UrlbarUtils.RESULT_SOURCE.OTHER_LOCAL, }); @@ -159,6 +164,7 @@ add_task(async function testOnImpressionNotification() { engagedResult, makeVisitResult(context, { uri: "https://example.com/", + title: "example.com", providerName: "secondProvider", source: UrlbarUtils.RESULT_SOURCE.OTHER_LOCAL, }), @@ -213,6 +219,7 @@ add_task(async function testOnSearchSessionEndNotification() { const engagedResult = makeVisitResult(context, { uri: "https://mozilla.com/", + title: "mozilla.com", providerName: "firstProvider", source: UrlbarUtils.RESULT_SOURCE.OTHER_LOCAL, }); @@ -223,6 +230,7 @@ add_task(async function testOnSearchSessionEndNotification() { engagedResult, makeVisitResult(context, { uri: "https://example.com/", + title: "example.com", providerName: "secondProvider", source: UrlbarUtils.RESULT_SOURCE.OTHER_LOCAL, }),