diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-15 03:35:49 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-15 03:35:49 +0000 |
commit | d8bbc7858622b6d9c278469aab701ca0b609cddf (patch) | |
tree | eff41dc61d9f714852212739e6b3738b82a2af87 /toolkit/components/formautofill/shared | |
parent | Releasing progress-linux version 125.0.3-1~progress7.99u1. (diff) | |
download | firefox-d8bbc7858622b6d9c278469aab701ca0b609cddf.tar.xz firefox-d8bbc7858622b6d9c278469aab701ca0b609cddf.zip |
Merging upstream version 126.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'toolkit/components/formautofill/shared')
3 files changed, 46 insertions, 5 deletions
diff --git a/toolkit/components/formautofill/shared/AddressComponent.sys.mjs b/toolkit/components/formautofill/shared/AddressComponent.sys.mjs index 40e00b66a0..e83cd22251 100644 --- a/toolkit/components/formautofill/shared/AddressComponent.sys.mjs +++ b/toolkit/components/formautofill/shared/AddressComponent.sys.mjs @@ -412,7 +412,6 @@ class State extends AddressField { const options = { merge_whitespace: true, - remove_punctuation: true, }; this.#state = lazy.FormAutofillUtils.getAbbreviatedSubregionName( this.normalizeUserValue(options), @@ -991,7 +990,7 @@ export class AddressComparison { * country, postal code, etc. The class provides a compare methods * to compare another AddressComponent against the current instance. * - * Note. This class assumes records that pass to it have already been normalized. + * Note: This class assumes records that pass to it have already been normalized. */ export class AddressComponent { /** diff --git a/toolkit/components/formautofill/shared/FormAutofillSection.sys.mjs b/toolkit/components/formautofill/shared/FormAutofillSection.sys.mjs index 7bda4c167b..1a5b3014c9 100644 --- a/toolkit/components/formautofill/shared/FormAutofillSection.sys.mjs +++ b/toolkit/components/formautofill/shared/FormAutofillSection.sys.mjs @@ -136,15 +136,15 @@ export class FormAutofillSection { * specific case. Return the original value in the default case. * @param {String} value * The original field value. - * @param {Object} fieldDetail + * @param {Object} _fieldName * A fieldDetail of the related element. - * @param {HTMLElement} element + * @param {HTMLElement} _element * A element for checking converting value. * * @returns {String} * A string of the converted value. */ - computeFillingValue(value, fieldName, element) { + computeFillingValue(value, _fieldName, _element) { return value; } diff --git a/toolkit/components/formautofill/shared/FormAutofillUtils.sys.mjs b/toolkit/components/formautofill/shared/FormAutofillUtils.sys.mjs index e86f14975c..c2b48a53a3 100644 --- a/toolkit/components/formautofill/shared/FormAutofillUtils.sys.mjs +++ b/toolkit/components/formautofill/shared/FormAutofillUtils.sys.mjs @@ -176,6 +176,12 @@ FormAutofillUtils = { return Array.from(categories); }, + getCollectionNameFromFieldName(fieldName) { + return this.isCreditCardField(fieldName) + ? CREDITCARDS_COLLECTION_NAME + : ADDRESSES_COLLECTION_NAME; + }, + getAddressSeparator() { // The separator should be based on the L10N address format, and using a // white space is a temporary solution. @@ -799,6 +805,42 @@ FormAutofillUtils = { return null; }, + /** + * Find the option element from xul menu popups, as used in address capture + * doorhanger. + * + * This is a proxy to `findAddressSelectOption`, which expects HTML select + * DOM nodes and operates on options instead of xul menuitems. + * + * NOTE: This is a temporary solution until Bug 1886949 is landed. This + * method will then be removed `findAddressSelectOption` will be used + * directly. + * + * @param {XULPopupElement} menupopup + * @param {object} address + * @param {string} fieldName + * @returns {XULElement} + */ + findAddressSelectOptionWithMenuPopup(menupopup, address, fieldName) { + class MenuitemProxy { + constructor(menuitem) { + this.menuitem = menuitem; + } + get text() { + return this.menuitem.label; + } + get value() { + return this.menuitem.value; + } + } + const selectEl = { + options: Array.from(menupopup.childNodes).map( + menuitem => new MenuitemProxy(menuitem) + ), + }; + return this.findAddressSelectOption(selectEl, address, fieldName)?.menuitem; + }, + findCreditCardSelectOption(selectEl, creditCard, fieldName) { let oneDigitMonth = creditCard["cc-exp-month"] ? creditCard["cc-exp-month"].toString() |