commit 91e6069b9c1e7289d0c727b5110e144edc589204
parent 60e814a2e1b8426e1e4ee2277a561bc6b06f8f89
Author: Rob Wu <rob@robwu.nl>
Date: Sun, 12 Oct 2025 11:23:19 +0000
Bug 1993426 - Avoid l10n-args logspam when using findbar r=akulyk
With the changes from bug 1987972, onMatchesCountResult can now get more
parameters than expected, which causes logspam via Fluent.
To fix this, select only the properties that are strictly needed for the
strings, which are defined in
https://searchfox.org/firefox-main/rev/2d38cd5bd7d7958137dd5b4f97aef2f7185a0eb1/toolkit/locales/en-US/toolkit/main-window/findbar.ftl#57-74
Differential Revision: https://phabricator.services.mozilla.com/D268091
Diffstat:
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/toolkit/content/widgets/findbar.js b/toolkit/content/widgets/findbar.js
@@ -1321,12 +1321,16 @@
this._foundMatches.hidden = true;
this._foundMatches.setAttribute("value", "");
} else {
- const l10nId =
- result.total === -1
- ? "findbar-found-matches-count-limit"
- : "findbar-found-matches";
+ let l10nId, l10nArgs;
+ if (result.total === -1) {
+ l10nId = "findbar-found-matches-count-limit";
+ l10nArgs = { limit: result.limit };
+ } else {
+ l10nId = "findbar-found-matches";
+ l10nArgs = { current: result.current, total: result.total };
+ }
this._foundMatches.hidden = false;
- document.l10n.setAttributes(this._foundMatches, l10nId, result);
+ document.l10n.setAttributes(this._foundMatches, l10nId, l10nArgs);
}
}