Remove the unused _discarded field in UrlbarParentController.sys.mjs
Categories
(Firefox :: Address Bar, task, P3)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox157 | --- | fixed |
People
(Reporter: dao, Assigned: blessedonekobo, Mentored)
Details
(Keywords: good-first-bug, Whiteboard: [lang=js])
Attachments
(1 file)
TelemetryEvent._discarded in browser/components/urlbar/UrlbarParentController.sys.mjs is written but never read, and should be removed.
There are exactly two references, both assignments:
- in
record(), inside thefinallyblock:this._discarded = false; - in
discard():this._discarded = true;
Nothing reads the field, and it has no declaration either -- those two assignments are the only places it exists. Its last reader was removed in bug 1888905 (April 2024), which dropped the if (this._discarded && this._category && ...) check that used it.
The fix is to delete both assignment lines. Two things to leave alone: keep the if (this._startEventInfo) check that discard() wraps around its assignment, and don't touch _startEventInfo itself -- that one is very much in use. No other restructuring of either method is wanted.
Link to the code:
https://searchfox.org/firefox-main/source/browser/components/urlbar/UrlbarParentController.sys.mjs
Both references, which this search should stop returning once the patch is done:
https://searchfox.org/firefox-main/search?q=_discarded&path=browser%2Fcomponents%2Furlbar
To verify the fix:
./mach lint -l eslint browser/components/urlbar/UrlbarParentController.sys.mjs
./mach mochitest browser/components/urlbar/tests/browser-engagementTelemetry/
That mochitest directory is the engagement-telemetry suite, which exercises both record() and discard(). It should stay green: removing a field that nothing reads cannot change behavior.
Tutorial to contribute:
https://firefox-source-docs.mozilla.org/contributing/contribution_quickref.html
https://firefox-source-docs.mozilla.org/contributing/stack_quickref.html
Please don't ask for the bug to be assigned. It will be automatically assigned to the first patch.
Updated•1 month ago
|
Comment 1•28 days ago
|
||
New contributor working on a patch for this bug
TelemetryEvent._discarded in browser/components/urlbar/UrlbarParentController.sys.mjs is written but never read
Updated•27 days ago
|
Comment 4•27 days ago
|
||
| bugherder | ||
Updated•26 days ago
|
Description
•