tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit 742af503898610c33f23a32fb8047833807ca2d3
parent 7c99e9f7c9b7a40d88e3c300cb995ca661ecebb0
Author: Mike Conley <mconley@mozilla.com>
Date:   Thu,  8 Jan 2026 19:18:48 +0000

Bug 2004784 - Part 2: Register the handoff bar using the newtab component registry. r=search-reviewers,Standard8

Differential Revision: https://phabricator.services.mozilla.com/D276861

Diffstat:
Mbrowser/components/BrowserComponents.manifest | 2++
Mbrowser/components/search/SearchUIUtils.sys.mjs | 30++++++++++++++++++++++++++++--
2 files changed, 30 insertions(+), 2 deletions(-)

diff --git a/browser/components/BrowserComponents.manifest b/browser/components/BrowserComponents.manifest @@ -107,3 +107,5 @@ category browser-quit-application-granted moz-src:///browser/components/urlbar/U category browser-quit-application-granted moz-src:///browser/components/ipprotection/IPProtectionService.sys.mjs IPProtectionService.uninit category search-service-notification moz-src:///browser/components/search/SearchUIUtils.sys.mjs SearchUIUtils.showSearchServiceNotification + +category browser-newtab-external-component moz-src:///browser/components/search/SearchUIUtils.sys.mjs SearchNewTabComponentsRegistrant diff --git a/browser/components/search/SearchUIUtils.sys.mjs b/browser/components/search/SearchUIUtils.sys.mjs @@ -10,9 +10,12 @@ * @import { SearchUtils } from "moz-src:///toolkit/components/search/SearchUtils.sys.mjs" * @import { UrlbarInput } from "chrome://browser/content/urlbar/UrlbarInput.mjs"; */ - import { AppConstants } from "resource://gre/modules/AppConstants.sys.mjs"; import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs"; +import { + AboutNewTabComponentRegistry, + BaseAboutNewTabComponentRegistrant, +} from "moz-src:///browser/components/newtab/AboutNewTabComponents.sys.mjs"; const lazy = XPCOMUtils.declareLazy({ BrowserSearchTelemetry: @@ -34,7 +37,6 @@ export var SearchUIUtils = { init() { if (!this.initialized) { Services.obs.addObserver(this, "browser-search-engine-modified"); - this.initialized = true; } }, @@ -525,3 +527,27 @@ export var SearchUIUtils = { }); }, }; + +/** + * A registrant that adds the handoff search bar to about:newtab / about:home. + */ +export class SearchNewTabComponentsRegistrant extends BaseAboutNewTabComponentRegistrant { + getComponents() { + const { caretBlinkCount, caretBlinkTime } = Services.appinfo; + + return [ + { + type: AboutNewTabComponentRegistry.TYPES.SEARCH, + l10nURLs: [], + componentURL: "chrome://browser/content/contentSearchHandoffUI.mjs", + tagName: "content-search-handoff-ui", + cssVariables: { + "--caret-blink-count": + caretBlinkCount > -1 ? caretBlinkCount : "infinite", + "--caret-blink-time": + caretBlinkTime > 0 ? `${caretBlinkTime * 2}ms` : `${1134}ms`, + }, + }, + ]; + } +}