summaryrefslogtreecommitdiffstats
path: root/toolkit/components/formautofill/ProfileAutoCompleteResult.sys.mjs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:14:29 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:14:29 +0000
commitfbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8 (patch)
tree4c1ccaf5486d4f2009f9a338a98a83e886e29c97 /toolkit/components/formautofill/ProfileAutoCompleteResult.sys.mjs
parentReleasing progress-linux version 124.0.1-1~progress7.99u1. (diff)
downloadfirefox-fbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8.tar.xz
firefox-fbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8.zip
Merging upstream version 125.0.1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'toolkit/components/formautofill/ProfileAutoCompleteResult.sys.mjs')
-rw-r--r--toolkit/components/formautofill/ProfileAutoCompleteResult.sys.mjs62
1 files changed, 46 insertions, 16 deletions
diff --git a/toolkit/components/formautofill/ProfileAutoCompleteResult.sys.mjs b/toolkit/components/formautofill/ProfileAutoCompleteResult.sys.mjs
index 15fc1a520c..52ed8bed03 100644
--- a/toolkit/components/formautofill/ProfileAutoCompleteResult.sys.mjs
+++ b/toolkit/components/formautofill/ProfileAutoCompleteResult.sys.mjs
@@ -12,7 +12,7 @@ ChromeUtils.defineESModuleGetters(lazy, {
ChromeUtils.defineLazyGetter(
lazy,
"l10n",
- () => new Localization(["browser/preferences/formAutofill.ftl"], true)
+ () => new Localization(["toolkit/formautofill/formAutofill.ftl"], true)
);
class ProfileAutoCompleteResult {
@@ -100,16 +100,16 @@ class ProfileAutoCompleteResult {
* Get the secondary label based on the focused field name and related field names
* in the same form.
*
- * @param {string} focusedFieldName The field name of the focused input
- * @param {Array<object>} allFieldNames The field names in the same section
- * @param {object} profile The profile providing the labels to show.
+ * @param {string} _focusedFieldName The field name of the focused input
+ * @param {Array<object>} _allFieldNames The field names in the same section
+ * @param {object} _profile The profile providing the labels to show.
* @returns {string} The secondary label
*/
- _getSecondaryLabel(focusedFieldName, allFieldNames, profile) {
+ _getSecondaryLabel(_focusedFieldName, _allFieldNames, _profile) {
return "";
}
- _generateLabels(focusedFieldName, allFieldNames, profiles) {}
+ _generateLabels(_focusedFieldName, _allFieldNames, _profiles) {}
/**
* Get the value of the result at the given index.
@@ -190,19 +190,19 @@ class ProfileAutoCompleteResult {
/**
* Returns true if the value at the given index is removable
*
- * @param {number} index The index of the result to remove
+ * @param {number} _index The index of the result to remove
* @returns {boolean} True if the value is removable
*/
- isRemovableAt(index) {
+ isRemovableAt(_index) {
return false;
}
/**
* Removes a result from the resultset
*
- * @param {number} index The index of the result to remove
+ * @param {number} _index The index of the result to remove
*/
- removeValueAt(index) {
+ removeValueAt(_index) {
// There is no plan to support removing profiles via autocomplete.
}
}
@@ -277,10 +277,19 @@ export class AddressResult extends ProfileAutoCompleteResult {
}
_generateLabels(focusedFieldName, allFieldNames, profiles) {
+ const manageLabel = lazy.l10n.formatValueSync(
+ "autofill-manage-addresses-label"
+ );
+
if (this._isInputAutofilled) {
return [
{ primary: "", secondary: "" }, // Clear button
- { primary: "", secondary: "" }, // Footer
+ // Footer
+ {
+ primary: "",
+ secondary: "",
+ manageLabel,
+ },
];
}
@@ -306,6 +315,10 @@ export class AddressResult extends ProfileAutoCompleteResult {
),
};
});
+
+ const focusedCategory =
+ lazy.FormAutofillUtils.getCategoryFromFieldName(focusedFieldName);
+
// Add an empty result entry for footer. Its content will come from
// the footer binding, so don't assign any value to it.
// The additional properties: categories and focusedCategory are required of
@@ -313,12 +326,11 @@ export class AddressResult extends ProfileAutoCompleteResult {
labels.push({
primary: "",
secondary: "",
+ manageLabel,
categories: lazy.FormAutofillUtils.getCategoriesFromFieldNames(
this._allFieldNames
),
- focusedCategory: lazy.FormAutofillUtils.getCategoryFromFieldName(
- this._focusedFieldName
- ),
+ focusedCategory,
});
return labels;
@@ -385,10 +397,19 @@ export class CreditCardResult extends ProfileAutoCompleteResult {
];
}
+ const manageLabel = lazy.l10n.formatValueSync(
+ "autofill-manage-payment-methods-label"
+ );
+
if (this._isInputAutofilled) {
return [
{ primary: "", secondary: "" }, // Clear button
- { primary: "", secondary: "" }, // Footer
+ // Footer
+ {
+ primary: "",
+ secondary: "",
+ manageLabel,
+ },
];
}
@@ -431,8 +452,17 @@ export class CreditCardResult extends ProfileAutoCompleteResult {
image,
};
});
+
+ const focusedCategory =
+ lazy.FormAutofillUtils.getCategoryFromFieldName(focusedFieldName);
+
// Add an empty result entry for footer.
- labels.push({ primary: "", secondary: "" });
+ labels.push({
+ primary: "",
+ secondary: "",
+ manageLabel,
+ focusedCategory,
+ });
return labels;
}