tor-browser

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

commit 26079b173d2ac9ddb5e5215ce65acac1a0514390
parent 6345066547aa6519e56243d9ffdcd772ab7c60e9
Author: Mark Banner <standard8@mozilla.com>
Date:   Mon, 13 Oct 2025 13:14:26 +0000

Bug 1992354 - Remove unused category handling from TelemetryEvent. r=urlbar-reviewers,jteow

The category is always set, so there is no need for the null checks. It used to be reported to legacy
telemetry but has been replaced by the sap field in Glean telemetry.

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

Diffstat:
Mbrowser/components/urlbar/UrlbarController.sys.mjs | 13+++----------
Mbrowser/components/urlbar/UrlbarInput.sys.mjs | 5++++-
2 files changed, 7 insertions(+), 11 deletions(-)

diff --git a/browser/components/urlbar/UrlbarController.sys.mjs b/browser/components/urlbar/UrlbarController.sys.mjs @@ -93,10 +93,7 @@ export class UrlbarController { this._listeners = new Set(); this._userSelectionBehavior = "none"; - this.engagementEvent = new TelemetryEvent( - this, - options.eventTelemetryCategory - ); + this.engagementEvent = new TelemetryEvent(this); } get NOTIFICATIONS() { @@ -766,9 +763,8 @@ export class UrlbarController { * @see Events.yaml */ class TelemetryEvent { - constructor(controller, category) { + constructor(controller) { this._controller = controller; - this._category = category; lazy.UrlbarPrefs.addObserver(this); this.#readPingPrefs(); this._lastSearchDetailsForDisableSuggestTracking = null; @@ -819,9 +815,6 @@ class TelemetryEvent { return; } - if (!this._category) { - return; - } if (!event) { console.error("Must always provide an event"); return; @@ -913,7 +906,7 @@ class TelemetryEvent { #internalRecord(event, details) { const startEventInfo = this._startEventInfo; - if (!this._category || !startEventInfo) { + if (!startEventInfo) { return; } if ( diff --git a/browser/components/urlbar/UrlbarInput.sys.mjs b/browser/components/urlbar/UrlbarInput.sys.mjs @@ -91,6 +91,9 @@ let px = number => number.toFixed(2) + "px"; export class UrlbarInput { #allowBreakout = false; #breakoutBlockerCount = 0; + /** + * The source of the UrlbarInput for storing in events, e.g. `urlbar`, `searchbar`. + */ #eventTelemetryCategory; #userTypedValue; @@ -100,6 +103,7 @@ export class UrlbarInput { * @param {HTMLDivElement} options.textbox * The container element. * @param {string} options.eventTelemetryCategory + * The source of the UrlbarInput for storing in events, e.g. `urlbar`, `searchbar`. * @param {boolean} [options.isAddressbar] * Whether this instance is meant to display the browser's current address, * as opposed to being just a search input. @@ -113,7 +117,6 @@ export class UrlbarInput { this.panel = this.textbox.querySelector(".urlbarView"); this.controller = new lazy.UrlbarController({ input: this, - eventTelemetryCategory, manager: isAddressbar ? null : lazy.SearchbarProvidersManager, }); this.view = new lazy.UrlbarView(this);