mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 13:21:05 +00:00
Backed out 2 changesets (bug 1786708, bug 1446164) for causing multiple failures CLOSED TREE
Backed out changeset 469e2500f00e (bug 1446164) Backed out changeset 0d298c6f7475 (bug 1786708)
This commit is contained in:
parent
813f2168a5
commit
e1a0b90205
@ -44,7 +44,6 @@
|
||||
<link rel="localization" href="browser/preferences/clearSiteData.ftl"/>
|
||||
<link rel="localization" href="browser/preferences/colors.ftl"/>
|
||||
<link rel="localization" href="browser/preferences/connection.ftl"/>
|
||||
<link rel="localization" href="browser/preferences/formAutofill.ftl"/>
|
||||
<link rel="localization" href="browser/preferences/languages.ftl"/>
|
||||
<link rel="localization" href="browser/preferences/permissions.ftl"/>
|
||||
<link rel="localization" href="browser/preferences/selectBookmark.ftl"/>
|
||||
|
@ -7,13 +7,6 @@
|
||||
|
||||
"use strict";
|
||||
|
||||
const { FormAutofill } = ChromeUtils.import(
|
||||
"resource://autofill/FormAutofill.jsm"
|
||||
);
|
||||
const { FormAutofillUtils } = ChromeUtils.import(
|
||||
"resource://autofill/FormAutofillUtils.jsm"
|
||||
);
|
||||
|
||||
class EditAutofillForm {
|
||||
constructor(elements) {
|
||||
this._elements = elements;
|
||||
@ -148,6 +141,11 @@ class EditAddress extends EditAutofillForm {
|
||||
* @param {HTMLElement[]} elements
|
||||
* @param {object} record
|
||||
* @param {object} config
|
||||
* @param {string[]} config.DEFAULT_REGION
|
||||
* @param {function} config.getFormFormat Function to return form layout info for a given country.
|
||||
* @param {function} config.findAddressSelectOption Finds the matching select option for a given
|
||||
select element, address, and fieldName.
|
||||
* @param {string[]} config.countries
|
||||
* @param {boolean} [config.noValidate=undefined] Whether to validate the form
|
||||
*/
|
||||
constructor(elements, record, config) {
|
||||
@ -184,13 +182,11 @@ class EditAddress extends EditAutofillForm {
|
||||
this._record = record;
|
||||
if (!record) {
|
||||
record = {
|
||||
country: FormAutofill.DEFAULT_REGION,
|
||||
country: this.DEFAULT_REGION,
|
||||
};
|
||||
}
|
||||
|
||||
let { addressLevel1Options } = FormAutofillUtils.getFormFormat(
|
||||
record.country
|
||||
);
|
||||
let { addressLevel1Options } = this.getFormFormat(record.country);
|
||||
this.populateAddressLevel1(addressLevel1Options, record.country);
|
||||
|
||||
super.loadRecord(record);
|
||||
@ -261,32 +257,19 @@ class EditAddress extends EditAutofillForm {
|
||||
*/
|
||||
formatForm(country) {
|
||||
const {
|
||||
addressLevel3L10nId,
|
||||
addressLevel2L10nId,
|
||||
addressLevel1L10nId,
|
||||
addressLevel3Label,
|
||||
addressLevel2Label,
|
||||
addressLevel1Label,
|
||||
addressLevel1Options,
|
||||
postalCodeL10nId,
|
||||
postalCodeLabel,
|
||||
fieldsOrder: mailingFieldsOrder,
|
||||
postalCodePattern,
|
||||
countryRequiredFields,
|
||||
} = FormAutofillUtils.getFormFormat(country);
|
||||
|
||||
document.l10n.setAttributes(
|
||||
this._elements.addressLevel3Label,
|
||||
addressLevel3L10nId
|
||||
);
|
||||
document.l10n.setAttributes(
|
||||
this._elements.addressLevel2Label,
|
||||
addressLevel2L10nId
|
||||
);
|
||||
document.l10n.setAttributes(
|
||||
this._elements.addressLevel1Label,
|
||||
addressLevel1L10nId
|
||||
);
|
||||
document.l10n.setAttributes(
|
||||
this._elements.postalCodeLabel,
|
||||
postalCodeL10nId
|
||||
);
|
||||
} = this.getFormFormat(country);
|
||||
this._elements.addressLevel3Label.dataset.localization = addressLevel3Label;
|
||||
this._elements.addressLevel2Label.dataset.localization = addressLevel2Label;
|
||||
this._elements.addressLevel1Label.dataset.localization = addressLevel1Label;
|
||||
this._elements.postalCodeLabel.dataset.localization = postalCodeLabel;
|
||||
let addressFields = this._elements.form.dataset.addressFields;
|
||||
let extraRequiredFields = this._elements.form.dataset.extraRequiredFields;
|
||||
let fieldClasses = EditAddress.computeVisibleFields(
|
||||
@ -393,7 +376,7 @@ class EditAddress extends EditAutofillForm {
|
||||
return;
|
||||
}
|
||||
|
||||
let matchedSelectOption = FormAutofillUtils.findAddressSelectOption(
|
||||
let matchedSelectOption = this.findAddressSelectOption(
|
||||
field,
|
||||
{
|
||||
country,
|
||||
@ -468,14 +451,13 @@ class EditAddress extends EditAutofillForm {
|
||||
populateCountries() {
|
||||
let fragment = document.createDocumentFragment();
|
||||
// Sort countries by their visible names.
|
||||
let countries = [...FormAutofill.countries.entries()].sort((e1, e2) =>
|
||||
let countries = [...this.countries.entries()].sort((e1, e2) =>
|
||||
e1[1].localeCompare(e2[1])
|
||||
);
|
||||
for (let [country] of countries) {
|
||||
const countryName = Services.intl.getRegionDisplayNames(undefined, [
|
||||
country.toLowerCase(),
|
||||
]);
|
||||
const option = new Option(countryName, country);
|
||||
for (let country of countries) {
|
||||
let option = new Option();
|
||||
option.value = country[0];
|
||||
option.dataset.localizationRegion = country[0].toLowerCase();
|
||||
fragment.appendChild(option);
|
||||
}
|
||||
this._elements.country.appendChild(fragment);
|
||||
@ -499,11 +481,15 @@ class EditCreditCard extends EditAutofillForm {
|
||||
* @param {HTMLElement[]} elements
|
||||
* @param {object} record with a decrypted cc-number
|
||||
* @param {object} addresses in an object with guid keys for the billing address picker.
|
||||
* @param {object} config
|
||||
* @param {function} config.isCCNumber Function to determine if a string is a valid CC number.
|
||||
* @param {function} config.getSupportedNetworks Function to get the list of card networks
|
||||
*/
|
||||
constructor(elements, record, addresses) {
|
||||
constructor(elements, record, addresses, config) {
|
||||
super(elements);
|
||||
|
||||
this._addresses = addresses;
|
||||
Object.assign(this, config);
|
||||
Object.assign(this._elements, {
|
||||
ccNumber: this._elements.form.querySelector("#cc-number"),
|
||||
invalidCardNumberStringElement: this._elements.form.querySelector(
|
||||
@ -595,11 +581,11 @@ class EditCreditCard extends EditAutofillForm {
|
||||
// include an empty first option
|
||||
frag.appendChild(new Option("", ""));
|
||||
|
||||
let supportedNetworks = FormAutofillUtils.getCreditCardNetworks();
|
||||
let supportedNetworks = this.getSupportedNetworks();
|
||||
for (let id of supportedNetworks) {
|
||||
const option = new Option(undefined, id);
|
||||
// autofill-card-network-amex, ..., autofill-card-network-visa
|
||||
option.dataset.l10nId = `autofill-card-network-${id}`;
|
||||
let option = new Option();
|
||||
option.value = id;
|
||||
option.dataset.localization = "cardNetwork." + id;
|
||||
frag.appendChild(option);
|
||||
}
|
||||
this._elements.ccType.appendChild(frag);
|
||||
@ -622,7 +608,7 @@ class EditCreditCard extends EditAutofillForm {
|
||||
hasAddresses = true;
|
||||
let selected = guid == billingAddressGUID;
|
||||
let option = new Option(
|
||||
FormAutofillUtils.getAddressLabel(address),
|
||||
this.getAddressLabel(address),
|
||||
guid,
|
||||
selected,
|
||||
selected
|
||||
@ -642,7 +628,7 @@ class EditCreditCard extends EditAutofillForm {
|
||||
// Clear the error message if cc-number is valid
|
||||
if (
|
||||
event.target == this._elements.ccNumber &&
|
||||
FormAutofillUtils.isCCNumber(this._elements.ccNumber.value)
|
||||
this.isCCNumber(this._elements.ccNumber.value)
|
||||
) {
|
||||
this._elements.ccNumber.setCustomValidity("");
|
||||
}
|
||||
@ -653,10 +639,7 @@ class EditCreditCard extends EditAutofillForm {
|
||||
super.updateCustomValidity(field);
|
||||
|
||||
// Mark the cc-number field as invalid if the number is empty or invalid.
|
||||
if (
|
||||
field == this._elements.ccNumber &&
|
||||
!FormAutofillUtils.isCCNumber(field.value)
|
||||
) {
|
||||
if (field == this._elements.ccNumber && !this.isCCNumber(field.value)) {
|
||||
let invalidCardNumberString = this._elements
|
||||
.invalidCardNumberStringElement.textContent;
|
||||
field.setCustomValidity(invalidCardNumberString || " ");
|
||||
|
@ -2,18 +2,21 @@
|
||||
<!-- This Source Code Form is subject to the terms of the Mozilla Public
|
||||
- License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
|
||||
<!DOCTYPE html>
|
||||
<!DOCTYPE html [
|
||||
<!ENTITY % globalDTD SYSTEM "chrome://global/locale/global.dtd">
|
||||
%globalDTD;
|
||||
]>
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title data-l10n-id="autofill-add-new-address-title"></title>
|
||||
<link rel="localization" href="browser/preferences/formAutofill.ftl"/>
|
||||
<title data-localization="addNewAddressTitle"/>
|
||||
<link rel="stylesheet" href="chrome://formautofill/content/skin/editDialog-shared.css"/>
|
||||
<link rel="stylesheet" href="chrome://formautofill/content/skin/editAddress.css"/>
|
||||
<link rel="stylesheet" href="chrome://formautofill/content/skin/editDialog.css"/>
|
||||
<script src="chrome://formautofill/content/l10n.js"></script>
|
||||
<script src="chrome://formautofill/content/editDialog.js"></script>
|
||||
<script src="chrome://formautofill/content/autofillEditForms.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<body dir="&locale.dir;">
|
||||
<form id="form" class="editAddressForm" autocomplete="off">
|
||||
<!--
|
||||
The <span class="label-text" …/> needs to be after the form field in the same element in
|
||||
@ -22,24 +25,24 @@
|
||||
<div id="name-container" class="container">
|
||||
<label id="given-name-container">
|
||||
<input id="given-name" type="text" required="required"/>
|
||||
<span data-l10n-id="autofill-address-given-name" class="label-text"/>
|
||||
<span data-localization="givenName" class="label-text"/>
|
||||
</label>
|
||||
<label id="additional-name-container">
|
||||
<input id="additional-name" type="text"/>
|
||||
<span data-l10n-id="autofill-address-additional-name" class="label-text"/>
|
||||
<span data-localization="additionalName" class="label-text"/>
|
||||
</label>
|
||||
<label id="family-name-container">
|
||||
<input id="family-name" type="text" required="required"/>
|
||||
<span data-l10n-id="autofill-address-family-name" class="label-text"/>
|
||||
<span data-localization="familyName" class="label-text"/>
|
||||
</label>
|
||||
</div>
|
||||
<label id="organization-container" class="container">
|
||||
<input id="organization" type="text"/>
|
||||
<span data-l10n-id="autofill-address-organization" class="label-text"/>
|
||||
<span data-localization="organization2" class="label-text"/>
|
||||
</label>
|
||||
<label id="street-address-container" class="container">
|
||||
<textarea id="street-address" rows="3"/>
|
||||
<span data-l10n-id="autofill-address-street" class="label-text"/>
|
||||
<span data-localization="streetAddress" class="label-text"/>
|
||||
</label>
|
||||
<label id="address-level3-container" class="container">
|
||||
<input id="address-level3" type="text"/>
|
||||
@ -64,34 +67,49 @@
|
||||
<select id="country" required="required">
|
||||
<option/>
|
||||
</select>
|
||||
<span data-l10n-id="autofill-address-country" class="label-text"/>
|
||||
<span data-localization="country" class="label-text"/>
|
||||
</label>
|
||||
<label id="tel-container" class="container">
|
||||
<input id="tel" type="tel" dir="auto"/>
|
||||
<span data-l10n-id="autofill-address-tel" class="label-text"/>
|
||||
<span data-localization="tel" class="label-text"/>
|
||||
</label>
|
||||
<label id="email-container" class="container">
|
||||
<input id="email" type="email" required="required"/>
|
||||
<span data-l10n-id="autofill-address-email" class="label-text"/>
|
||||
<span data-localization="email" class="label-text"/>
|
||||
</label>
|
||||
</form>
|
||||
<div id="controls-container">
|
||||
<span id="country-warning-message" data-l10n-id="autofill-country-warning-message"/>
|
||||
<button id="cancel" data-l10n-id="autofill-cancel-button"/>
|
||||
<button id="save" class="primary" data-l10n-id="autofill-save-button"/>
|
||||
<span id="country-warning-message" data-localization="countryWarningMessage2"/>
|
||||
<button id="cancel" data-localization="cancelBtnLabel"/>
|
||||
<button id="save" class="primary" data-localization="saveBtnLabel"/>
|
||||
</div>
|
||||
<script><![CDATA[
|
||||
"use strict";
|
||||
|
||||
const {
|
||||
/* import-globals-from l10n.js */
|
||||
|
||||
let {
|
||||
DEFAULT_REGION,
|
||||
countries,
|
||||
} = FormAutofill;
|
||||
let {
|
||||
getFormFormat,
|
||||
findAddressSelectOption,
|
||||
} = FormAutofillUtils;
|
||||
let args = window.arguments || [];
|
||||
let {
|
||||
record,
|
||||
noValidate,
|
||||
} = window.arguments?.[0] ?? {};
|
||||
} = args[0] || {};
|
||||
|
||||
/* import-globals-from autofillEditForms.js */
|
||||
const fieldContainer = new EditAddress({
|
||||
var fieldContainer = new EditAddress({
|
||||
form: document.getElementById("form"),
|
||||
}, record, {
|
||||
DEFAULT_REGION,
|
||||
getFormFormat: getFormFormat.bind(FormAutofillUtils),
|
||||
findAddressSelectOption: findAddressSelectOption.bind(FormAutofillUtils),
|
||||
countries,
|
||||
noValidate,
|
||||
});
|
||||
|
||||
|
@ -2,52 +2,55 @@
|
||||
<!-- This Source Code Form is subject to the terms of the Mozilla Public
|
||||
- License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
|
||||
<!DOCTYPE html>
|
||||
<!DOCTYPE html [
|
||||
<!ENTITY % globalDTD SYSTEM "chrome://global/locale/global.dtd">
|
||||
%globalDTD;
|
||||
]>
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title data-l10n-id="autofill-add-new-card-title"></title>
|
||||
<link rel="localization" href="browser/preferences/formAutofill.ftl"/>
|
||||
<title data-localization="addNewCreditCardTitle"/>
|
||||
<link rel="stylesheet" href="chrome://formautofill/content/skin/editDialog-shared.css"/>
|
||||
<link rel="stylesheet" href="chrome://formautofill/content/skin/editCreditCard.css"/>
|
||||
<link rel="stylesheet" href="chrome://formautofill/content/skin/editDialog.css"/>
|
||||
<script src="chrome://formautofill/content/l10n.js"></script>
|
||||
<script src="chrome://formautofill/content/editDialog.js"></script>
|
||||
<script src="chrome://formautofill/content/autofillEditForms.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<body dir="&locale.dir;">
|
||||
<form id="form" class="editCreditCardForm contentPane" autocomplete="off">
|
||||
<!--
|
||||
The <span class="label-text" …/> needs to be after the form field in the same element in
|
||||
order to get proper label styling with :focus and :moz-ui-invalid.
|
||||
-->
|
||||
<label id="cc-number-container" class="container" role="none">
|
||||
<span id="invalidCardNumberString" hidden="hidden" data-l10n-id="autofill-card-invalid-number"></span>
|
||||
<span id="invalidCardNumberString" hidden="hidden" data-localization="invalidCardNumber"></span>
|
||||
<!-- Because there is text both before and after the input, a11y will
|
||||
include the value of the input in the label. Therefore, we override
|
||||
with aria-labelledby.
|
||||
-->
|
||||
<input id="cc-number" type="text" required="required" minlength="14" pattern="[- 0-9]+" aria-labelledby="cc-number-label"/>
|
||||
<span id="cc-number-label" data-l10n-id="autofill-card-number" class="label-text"/>
|
||||
<span id="cc-number-label" data-localization="cardNumber" class="label-text"/>
|
||||
</label>
|
||||
<label id="cc-exp-month-container" class="container">
|
||||
<select id="cc-exp-month" required="required">
|
||||
<option/>
|
||||
</select>
|
||||
<span data-l10n-id="autofill-card-expires-month" class="label-text"/>
|
||||
<span data-localization="cardExpiresMonth" class="label-text"/>
|
||||
</label>
|
||||
<label id="cc-exp-year-container" class="container">
|
||||
<select id="cc-exp-year" required="required">
|
||||
<option/>
|
||||
</select>
|
||||
<span data-l10n-id="autofill-card-expires-year" class="label-text"/>
|
||||
<span data-localization="cardExpiresYear" class="label-text"/>
|
||||
</label>
|
||||
<label id="cc-name-container" class="container">
|
||||
<input id="cc-name" type="text" required="required"/>
|
||||
<span data-l10n-id="autofill-card-name-on-card" class="label-text"/>
|
||||
<span data-localization="nameOnCard" class="label-text"/>
|
||||
</label>
|
||||
<label id="cc-type-container" class="container">
|
||||
<select id="cc-type" required="required">
|
||||
</select>
|
||||
<span data-l10n-id="autofill-card-network" class="label-text"/>
|
||||
<span data-localization="cardNetwork" class="label-text"/>
|
||||
</label>
|
||||
<label id="cc-csc-container" class="container" hidden="hidden">
|
||||
<!-- The CSC container will get filled in by forms that need a CSC (using csc-input.js) -->
|
||||
@ -55,33 +58,45 @@
|
||||
<div id="billingAddressGUID-container" class="billingAddressRow container rich-picker">
|
||||
<select id="billingAddressGUID" required="required">
|
||||
</select>
|
||||
<label for="billingAddressGUID" data-l10n-id="autofill-card-billing-address" class="label-text"/>
|
||||
<label for="billingAddressGUID" data-localization="billingAddress" class="label-text"/>
|
||||
</div>
|
||||
</form>
|
||||
<div id="controls-container">
|
||||
<button id="cancel" data-l10n-id="autofill-cancel-button"/>
|
||||
<button id="save" class="primary" data-l10n-id="autofill-save-button"/>
|
||||
<button id="cancel" data-localization="cancelBtnLabel"/>
|
||||
<button id="save" class="primary" data-localization="saveBtnLabel"/>
|
||||
</div>
|
||||
<script><![CDATA[
|
||||
"use strict";
|
||||
|
||||
/* import-globals-from editDialog.js */
|
||||
/* import-globals-from l10n.js */
|
||||
|
||||
(async () => {
|
||||
const {
|
||||
let {
|
||||
getAddressLabel,
|
||||
isCCNumber,
|
||||
getCreditCardNetworks,
|
||||
} = FormAutofillUtils;
|
||||
let args = window.arguments || [];
|
||||
let {
|
||||
record,
|
||||
} = window.arguments?.[0] ?? {};
|
||||
} = args[0] || {};
|
||||
|
||||
const addresses = {};
|
||||
let addresses = {};
|
||||
for (let address of await formAutofillStorage.addresses.getAll()) {
|
||||
addresses[address.guid] = address;
|
||||
}
|
||||
|
||||
/* import-globals-from autofillEditForms.js */
|
||||
const fieldContainer = new EditCreditCard({
|
||||
let fieldContainer = new EditCreditCard({
|
||||
form: document.getElementById("form"),
|
||||
}, record, addresses);
|
||||
}, record, addresses,
|
||||
{
|
||||
getAddressLabel: getAddressLabel.bind(FormAutofillUtils),
|
||||
isCCNumber: isCCNumber.bind(FormAutofillUtils),
|
||||
getSupportedNetworks: getCreditCardNetworks.bind(FormAutofillUtils),
|
||||
});
|
||||
|
||||
/* import-globals-from editDialog.js */
|
||||
new EditCreditCardDialog({
|
||||
title: document.querySelector("title"),
|
||||
fieldContainer,
|
||||
|
@ -7,6 +7,11 @@
|
||||
|
||||
"use strict";
|
||||
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { FormAutofill } = ChromeUtils.import(
|
||||
"resource://autofill/FormAutofill.jsm"
|
||||
);
|
||||
|
||||
ChromeUtils.defineModuleGetter(
|
||||
this,
|
||||
"formAutofillStorage",
|
||||
@ -155,10 +160,7 @@ class EditAddressDialog extends AutofillEditDialog {
|
||||
|
||||
localizeDocument() {
|
||||
if (this._record?.guid) {
|
||||
document.l10n.setAttributes(
|
||||
this._elements.title,
|
||||
"autofill-edit-address-title"
|
||||
);
|
||||
this._elements.title.dataset.localization = "editAddressTitle";
|
||||
}
|
||||
}
|
||||
|
||||
@ -191,10 +193,7 @@ class EditCreditCardDialog extends AutofillEditDialog {
|
||||
|
||||
localizeDocument() {
|
||||
if (this._record?.guid) {
|
||||
document.l10n.setAttributes(
|
||||
this._elements.title,
|
||||
"autofill-edit-card-title"
|
||||
);
|
||||
this._elements.title.dataset.localization = "editCreditCardTitle";
|
||||
}
|
||||
}
|
||||
|
||||
|
64
browser/extensions/formautofill/content/l10n.js
Normal file
64
browser/extensions/formautofill/content/l10n.js
Normal file
@ -0,0 +1,64 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* This file will be replaced by Fluent but it's a middle ground so we can share
|
||||
* the edit dialog code with the unprivileged PaymentRequest dialog before the
|
||||
* Fluent conversion
|
||||
*/
|
||||
|
||||
const { FormAutofillUtils } = ChromeUtils.import(
|
||||
"resource://autofill/FormAutofillUtils.jsm"
|
||||
);
|
||||
|
||||
const CONTENT_WIN = typeof window != "undefined" ? window : this;
|
||||
|
||||
const L10N_ATTRIBUTES = ["data-localization", "data-localization-region"];
|
||||
|
||||
// eslint-disable-next-line mozilla/balanced-listeners
|
||||
CONTENT_WIN.addEventListener("DOMContentLoaded", function onDCL(evt) {
|
||||
let doc = evt.target;
|
||||
FormAutofillUtils.localizeMarkup(doc);
|
||||
|
||||
let mutationObserver = new doc.ownerGlobal.MutationObserver(
|
||||
function onMutation(mutations) {
|
||||
for (let mutation of mutations) {
|
||||
switch (mutation.type) {
|
||||
case "attributes": {
|
||||
if (!mutation.target.hasAttribute(mutation.attributeName)) {
|
||||
// The attribute was removed in the meantime.
|
||||
continue;
|
||||
}
|
||||
FormAutofillUtils.localizeAttributeForElement(
|
||||
mutation.target,
|
||||
mutation.attributeName
|
||||
);
|
||||
break;
|
||||
}
|
||||
|
||||
case "childList": {
|
||||
// We really only care about elements appending inside pages.
|
||||
let parent = HTMLDocument.isInstance(mutation.target)
|
||||
? mutation.target.documentElement
|
||||
: mutation.target;
|
||||
if (!mutation.addedNodes || !parent.closest(".page")) {
|
||||
break;
|
||||
}
|
||||
FormAutofillUtils.localizeMarkup(mutation.target);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
mutationObserver.observe(doc, {
|
||||
attributes: true,
|
||||
attributeFilter: L10N_ATTRIBUTES,
|
||||
childList: true,
|
||||
subtree: true,
|
||||
});
|
||||
});
|
@ -2,27 +2,29 @@
|
||||
<!-- This Source Code Form is subject to the terms of the Mozilla Public
|
||||
- License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
|
||||
<!DOCTYPE html>
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" data-l10n-id="autofill-manage-dialog" data-l10n-attrs="style">
|
||||
<!DOCTYPE html [
|
||||
<!ENTITY % globalDTD SYSTEM "chrome://global/locale/global.dtd">
|
||||
%globalDTD;
|
||||
]>
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title data-l10n-id="autofill-manage-addresses-title"></title>
|
||||
<link rel="localization" href="browser/preferences/formAutofill.ftl"/>
|
||||
<title data-localization="manageAddressesTitle"/>
|
||||
<link rel="stylesheet" href="chrome://global/skin/in-content/common.css" />
|
||||
<link rel="stylesheet" href="chrome://formautofill/content/manageDialog.css" />
|
||||
<script src="chrome://formautofill/content/manageDialog.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<body dir="&locale.dir;">
|
||||
<fieldset>
|
||||
<legend data-l10n-id="autofill-manage-addresses-list-header"/>
|
||||
<legend data-localization="addressesListHeader"/>
|
||||
<select id="addresses" size="9" multiple="multiple"/>
|
||||
</fieldset>
|
||||
<div id="controls-container">
|
||||
<button id="remove" disabled="disabled" data-l10n-id="autofill-manage-remove-button"/>
|
||||
<button id="remove" disabled="disabled" data-localization="removeBtnLabel"/>
|
||||
<!-- Wrapper is used to properly compute the search tooltip position -->
|
||||
<div>
|
||||
<button id="add" data-l10n-id="autofill-manage-add-button"/>
|
||||
<button id="add" data-localization="addBtnLabel"/>
|
||||
</div>
|
||||
<button id="edit" disabled="disabled" data-l10n-id="autofill-manage-edit-button"/>
|
||||
<button id="edit" disabled="disabled" data-localization="editBtnLabel"/>
|
||||
</div>
|
||||
<script>
|
||||
"use strict";
|
||||
|
@ -2,28 +2,30 @@
|
||||
<!-- This Source Code Form is subject to the terms of the Mozilla Public
|
||||
- License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
|
||||
<!DOCTYPE html>
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" data-l10n-id="autofill-manage-dialog" data-l10n-attrs="style">
|
||||
<!DOCTYPE html [
|
||||
<!ENTITY % globalDTD SYSTEM "chrome://global/locale/global.dtd">
|
||||
%globalDTD;
|
||||
]>
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title data-l10n-id="autofill-manage-credit-cards-title"></title>
|
||||
<link rel="localization" href="browser/preferences/formAutofill.ftl"/>
|
||||
<title data-localization="manageCreditCardsTitle"/>
|
||||
<link rel="localization" href="toolkit/payments/payments.ftl"/>
|
||||
<link rel="stylesheet" href="chrome://global/skin/in-content/common.css" />
|
||||
<link rel="stylesheet" href="chrome://formautofill/content/manageDialog.css" />
|
||||
<script src="chrome://formautofill/content/manageDialog.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<body dir="&locale.dir;">
|
||||
<fieldset>
|
||||
<legend data-l10n-id="autofill-manage-credit-cards-list-header"/>
|
||||
<legend data-localization="creditCardsListHeader"/>
|
||||
<select id="credit-cards" size="9" multiple="multiple"/>
|
||||
</fieldset>
|
||||
<div id="controls-container">
|
||||
<button id="remove" disabled="disabled" data-l10n-id="autofill-manage-remove-button"/>
|
||||
<button id="remove" disabled="disabled" data-localization="removeBtnLabel"/>
|
||||
<!-- Wrapper is used to properly compute the search tooltip position -->
|
||||
<div>
|
||||
<button id="add" data-l10n-id="autofill-manage-add-button"/>
|
||||
<button id="add" data-localization="addBtnLabel"/>
|
||||
</div>
|
||||
<button id="edit" disabled="disabled" data-l10n-id="autofill-manage-edit-button"/>
|
||||
<button id="edit" disabled="disabled" data-localization="editBtnLabel"/>
|
||||
</div>
|
||||
<script>
|
||||
"use strict";
|
||||
|
@ -41,16 +41,17 @@ ChromeUtils.defineModuleGetter(
|
||||
"resource://gre/modules/OSKeyStore.jsm"
|
||||
);
|
||||
|
||||
const lazy = {};
|
||||
XPCOMUtils.defineLazyGetter(
|
||||
lazy,
|
||||
"l10n",
|
||||
() =>
|
||||
new Localization([
|
||||
"browser/preferences/formAutofill.ftl",
|
||||
"branding/brand.ftl",
|
||||
])
|
||||
);
|
||||
XPCOMUtils.defineLazyGetter(this, "reauthPasswordPromptMessage", () => {
|
||||
const brandShortName = FormAutofillUtils.brandBundle.GetStringFromName(
|
||||
"brandShortName"
|
||||
);
|
||||
// The string name for Mac is changed because the value needed updating.
|
||||
const platform = AppConstants.platform.replace("macosx", "macos");
|
||||
return FormAutofillUtils.stringBundle.formatStringFromName(
|
||||
`editCreditCardPasswordPrompt.${platform}`,
|
||||
[brandShortName]
|
||||
);
|
||||
});
|
||||
|
||||
this.log = null;
|
||||
XPCOMUtils.defineLazyGetter(this, "log", () =>
|
||||
@ -65,6 +66,7 @@ class ManageRecords {
|
||||
this._newRequest = false;
|
||||
this._isLoadingRecords = false;
|
||||
this.prefWin = window.opener;
|
||||
this.localizeDocument();
|
||||
window.addEventListener("DOMContentLoaded", this, { once: true });
|
||||
}
|
||||
|
||||
@ -81,6 +83,13 @@ class ManageRecords {
|
||||
this._elements = null;
|
||||
}
|
||||
|
||||
localizeDocument() {
|
||||
document.documentElement.style.minWidth = FormAutofillUtils.stringBundle.GetStringFromName(
|
||||
"manageDialogsWidth"
|
||||
);
|
||||
FormAutofillUtils.localizeMarkup(document);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the selected options on the addresses element.
|
||||
*
|
||||
@ -150,7 +159,7 @@ class ManageRecords {
|
||||
let selectedGuids = this._selectedOptions.map(option => option.value);
|
||||
this.clearRecordElements();
|
||||
for (let record of records) {
|
||||
let { id, args, raw } = await this.getLabelInfo(record);
|
||||
let { id, args, raw } = this.getLabelInfo(record);
|
||||
let option = new Option(
|
||||
raw ?? "",
|
||||
record.guid,
|
||||
@ -323,8 +332,10 @@ class ManageAddresses extends ManageRecords {
|
||||
constructor(elements) {
|
||||
super("addresses", elements);
|
||||
elements.add.setAttribute(
|
||||
"search-l10n-ids",
|
||||
FormAutofillUtils.EDIT_ADDRESS_L10N_IDS.join(",")
|
||||
"searchkeywords",
|
||||
FormAutofillUtils.EDIT_ADDRESS_KEYWORDS.map(key =>
|
||||
FormAutofillUtils.stringBundle.GetStringFromName(key)
|
||||
).join("\n")
|
||||
);
|
||||
}
|
||||
|
||||
@ -351,8 +362,10 @@ class ManageCreditCards extends ManageRecords {
|
||||
constructor(elements) {
|
||||
super("creditCards", elements);
|
||||
elements.add.setAttribute(
|
||||
"search-l10n-ids",
|
||||
FormAutofillUtils.EDIT_CREDITCARD_L10N_IDS.join(",")
|
||||
"searchkeywords",
|
||||
FormAutofillUtils.EDIT_CREDITCARD_KEYWORDS.map(key =>
|
||||
FormAutofillUtils.stringBundle.GetStringFromName(key)
|
||||
).join("\n")
|
||||
);
|
||||
|
||||
Services.telemetry.recordEvent("creditcard", "show", "manage");
|
||||
@ -367,45 +380,43 @@ class ManageCreditCards extends ManageRecords {
|
||||
*/
|
||||
async openEditDialog(creditCard) {
|
||||
// Ask for reauth if user is trying to edit an existing credit card.
|
||||
if (creditCard) {
|
||||
const reauthPasswordPromptMessage = await lazy.l10n.formatValue(
|
||||
"autofill-edit-card-password-prompt"
|
||||
);
|
||||
const loggedIn = await FormAutofillUtils.ensureLoggedIn(
|
||||
reauthPasswordPromptMessage
|
||||
);
|
||||
if (!loggedIn.authenticated) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
let decryptedCCNumObj = {};
|
||||
if (creditCard && creditCard["cc-number-encrypted"]) {
|
||||
try {
|
||||
decryptedCCNumObj["cc-number"] = await OSKeyStore.decrypt(
|
||||
creditCard["cc-number-encrypted"]
|
||||
);
|
||||
} catch (ex) {
|
||||
if (ex.result == Cr.NS_ERROR_ABORT) {
|
||||
// User shouldn't be ask to reauth here, but it could happen.
|
||||
// Return here and skip opening the dialog.
|
||||
return;
|
||||
if (
|
||||
!creditCard ||
|
||||
(await FormAutofillUtils.ensureLoggedIn(reauthPasswordPromptMessage))
|
||||
.authenticated
|
||||
) {
|
||||
let decryptedCCNumObj = {};
|
||||
if (creditCard && creditCard["cc-number-encrypted"]) {
|
||||
try {
|
||||
decryptedCCNumObj["cc-number"] = await OSKeyStore.decrypt(
|
||||
creditCard["cc-number-encrypted"]
|
||||
);
|
||||
} catch (ex) {
|
||||
if (ex.result == Cr.NS_ERROR_ABORT) {
|
||||
// User shouldn't be ask to reauth here, but it could happen.
|
||||
// Return here and skip opening the dialog.
|
||||
return;
|
||||
}
|
||||
// We've got ourselves a real error.
|
||||
// Recover from encryption error so the user gets a chance to re-enter
|
||||
// unencrypted credit card number.
|
||||
decryptedCCNumObj["cc-number"] = "";
|
||||
Cu.reportError(ex);
|
||||
}
|
||||
// We've got ourselves a real error.
|
||||
// Recover from encryption error so the user gets a chance to re-enter
|
||||
// unencrypted credit card number.
|
||||
decryptedCCNumObj["cc-number"] = "";
|
||||
Cu.reportError(ex);
|
||||
}
|
||||
let decryptedCreditCard = Object.assign(
|
||||
{},
|
||||
creditCard,
|
||||
decryptedCCNumObj
|
||||
);
|
||||
this.prefWin.gSubDialog.open(
|
||||
EDIT_CREDIT_CARD_URL,
|
||||
{ features: "resizable=no" },
|
||||
{
|
||||
record: decryptedCreditCard,
|
||||
}
|
||||
);
|
||||
}
|
||||
let decryptedCreditCard = Object.assign({}, creditCard, decryptedCCNumObj);
|
||||
this.prefWin.gSubDialog.open(
|
||||
EDIT_CREDIT_CARD_URL,
|
||||
{ features: "resizable=no" },
|
||||
{
|
||||
record: decryptedCreditCard,
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -413,17 +424,22 @@ class ManageCreditCards extends ManageRecords {
|
||||
* cardholder's name, separated by a comma.
|
||||
*
|
||||
* @param {object} creditCard
|
||||
* @returns {Promise<string>}
|
||||
* @returns {string}
|
||||
*/
|
||||
async getLabelInfo(creditCard) {
|
||||
getLabelInfo(creditCard) {
|
||||
// The card type is displayed visually using an image. For a11y, we need
|
||||
// to expose it as text. We do this using aria-label. However,
|
||||
// aria-label overrides the text content, so we must include that also.
|
||||
// Since the text content is generated by Fluent, aria-label must be
|
||||
// generated by Fluent also.
|
||||
const type = await document.l10n.formatValue(
|
||||
`autofill-card-network-${creditCard["cc-type"]}`
|
||||
);
|
||||
let type;
|
||||
try {
|
||||
type = FormAutofillUtils.stringBundle.GetStringFromName(
|
||||
`cardNetwork.${creditCard["cc-type"]}`
|
||||
);
|
||||
} catch (e) {
|
||||
type = ""; // Unknown.
|
||||
}
|
||||
return CreditCard.getLabelInfo({
|
||||
name: creditCard["cc-name"],
|
||||
number: creditCard["cc-number"],
|
||||
|
@ -111,6 +111,117 @@ autofillReauthOSDialogMac = change the authentication settings
|
||||
autofillReauthOSDialogWin = To change the authentication settings, enter your Windows login credentials.
|
||||
autofillReauthOSDialogLin = To change the authentication settings, enter your Linux login credentials.
|
||||
|
||||
# LOCALIZATION NOTE (manageAddressesTitle, manageCreditCardsTitle): The dialog title for the list of addresses or
|
||||
# credit cards in browser preferences.
|
||||
manageAddressesTitle = Saved Addresses
|
||||
manageCreditCardsTitle = Saved Credit Cards
|
||||
# LOCALIZATION NOTE (addressesListHeader, creditCardsListHeader): The header for the list of addresses or credit cards
|
||||
# in browser preferences.
|
||||
addressesListHeader = Addresses
|
||||
creditCardsListHeader = Credit Cards
|
||||
removeBtnLabel = Remove
|
||||
addBtnLabel = Add…
|
||||
editBtnLabel = Edit…
|
||||
# LOCALIZATION NOTE (manageDialogsWidth): This strings sets the default width for windows used to manage addresses and
|
||||
# credit cards.
|
||||
manageDialogsWidth = 560px
|
||||
|
||||
# LOCALIZATION NOTE (addNewAddressTitle, editAddressTitle): The dialog title for creating or editing addresses
|
||||
# in browser preferences.
|
||||
addNewAddressTitle = Add New Address
|
||||
editAddressTitle = Edit Address
|
||||
givenName = First Name
|
||||
additionalName = Middle Name
|
||||
familyName = Last Name
|
||||
organization2 = Organization
|
||||
streetAddress = Street Address
|
||||
|
||||
## address-level-3 (Sublocality) names
|
||||
# LOCALIZATION NOTE (neighborhood): Used in IR, MX
|
||||
neighborhood = Neighborhood
|
||||
# LOCALIZATION NOTE (village_township): Used in MY
|
||||
village_township = Village or Township
|
||||
island = Island
|
||||
# LOCALIZATION NOTE (townland): Used in IE
|
||||
townland = Townland
|
||||
|
||||
## address-level-2 names
|
||||
city = City
|
||||
# LOCALIZATION NOTE (district): Used in HK, SD, SY, TR as Address Level-2
|
||||
# and used in KR as Sublocality.
|
||||
district = District
|
||||
# LOCALIZATION NOTE (post_town): Used in GB, NO, SE
|
||||
post_town = Post town
|
||||
# LOCALIZATION NOTE (suburb): Used in AU as Address Level-2
|
||||
# and used in ZZ as Sublocality.
|
||||
suburb = Suburb
|
||||
|
||||
# address-level-1 names
|
||||
province = Province
|
||||
state = State
|
||||
county = County
|
||||
# LOCALIZATION NOTE (parish): Used in BB, JM
|
||||
parish = Parish
|
||||
# LOCALIZATION NOTE (prefecture): Used in JP
|
||||
prefecture = Prefecture
|
||||
# LOCALIZATION NOTE (area): Used in HK
|
||||
area = Area
|
||||
# LOCALIZATION NOTE (do_si): Used in KR
|
||||
do_si = Do/Si
|
||||
# LOCALIZATION NOTE (department): Used in NI, CO
|
||||
department = Department
|
||||
# LOCALIZATION NOTE (emirate): Used in AE
|
||||
emirate = Emirate
|
||||
# LOCALIZATION NOTE (oblast): Used in RU and UA
|
||||
oblast = Oblast
|
||||
|
||||
# LOCALIZATION NOTE (pin, postalCode, zip, eircode): Postal code name types
|
||||
# LOCALIZATION NOTE (pin): Used in IN
|
||||
pin = Pin
|
||||
postalCode = Postal Code
|
||||
zip = ZIP Code
|
||||
# LOCALIZATION NOTE (eircode): Used in IE
|
||||
eircode = Eircode
|
||||
|
||||
country = Country or Region
|
||||
tel = Phone
|
||||
email = Email
|
||||
cancelBtnLabel = Cancel
|
||||
saveBtnLabel = Save
|
||||
countryWarningMessage2 = Form Autofill is currently available only for certain countries.
|
||||
|
||||
# LOCALIZATION NOTE (addNewCreditCardTitle, editCreditCardTitle): The dialog title for creating or editing
|
||||
# credit cards in browser preferences.
|
||||
addNewCreditCardTitle = Add New Credit Card
|
||||
editCreditCardTitle = Edit Credit Card
|
||||
cardNumber = Card Number
|
||||
invalidCardNumber = Please enter a valid card number
|
||||
nameOnCard = Name on Card
|
||||
cardExpiresMonth = Exp. Month
|
||||
cardExpiresYear = Exp. Year
|
||||
billingAddress = Billing Address
|
||||
cardNetwork = Card Type
|
||||
# LOCALIZATION NOTE (cardCVV): Credit card security code https://en.wikipedia.org/wiki/Card_security_code
|
||||
cardCVV = CVV
|
||||
|
||||
# LOCALIZATION NOTE: (cardNetwork.*): These are brand names and should only be translated when a locale-specific name for that brand is in common use
|
||||
cardNetwork.amex = American Express
|
||||
cardNetwork.cartebancaire = Carte Bancaire
|
||||
cardNetwork.diners = Diners Club
|
||||
cardNetwork.discover = Discover
|
||||
cardNetwork.jcb = JCB
|
||||
cardNetwork.mastercard = MasterCard
|
||||
cardNetwork.mir = MIR
|
||||
cardNetwork.unionpay = Union Pay
|
||||
cardNetwork.visa = Visa
|
||||
|
||||
# LOCALIZATION NOTE (editCreditCardPasswordPrompt.*, useCreditCardPasswordPrompt.*): %S is brandShortName.
|
||||
editCreditCardPasswordPrompt.win = %S is trying to show credit card information. Confirm access to this Windows account below.
|
||||
# LOCALIZATION NOTE (editCreditCardPasswordPrompt.macos): This string is
|
||||
# preceded by the operating system (macOS) with "Firefox is trying to ", and
|
||||
# has a period added to its end. Make sure to test in your locale.
|
||||
editCreditCardPasswordPrompt.macos = show credit card information
|
||||
editCreditCardPasswordPrompt.linux = %S is trying to show credit card information.
|
||||
useCreditCardPasswordPrompt.win = %S is trying to use stored credit card information. Confirm access to this Windows account below.
|
||||
# LOCALIZATION NOTE (useCreditCardPasswordPrompt.macos): This string is
|
||||
# preceded by the operating system (macOS) with "Firefox is trying to ", and
|
||||
|
@ -528,35 +528,39 @@ add_task(async function test_countryAndStateFieldLabels() {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Clear L10N textContent to not leave leftovers between country tests
|
||||
// Clear L10N attributes and textContent to not leave leftovers between country tests
|
||||
for (let labelEl of mutableLabels) {
|
||||
doc.l10n.setAttributes(labelEl, "");
|
||||
labelEl.textContent = "";
|
||||
delete labelEl.dataset.localization;
|
||||
}
|
||||
|
||||
info(`Selecting '${countryOption.label}' (${countryOption.value})`);
|
||||
EventUtils.synthesizeKey(countryOption.label, {}, win);
|
||||
|
||||
let l10nResolve;
|
||||
let l10nReady = new Promise(resolve => {
|
||||
l10nResolve = resolve;
|
||||
});
|
||||
let verifyL10n = () => {
|
||||
if (mutableLabels.every(labelEl => labelEl.textContent)) {
|
||||
win.removeEventListener("MozAfterPaint", verifyL10n);
|
||||
l10nResolve();
|
||||
}
|
||||
};
|
||||
win.addEventListener("MozAfterPaint", verifyL10n);
|
||||
await l10nReady;
|
||||
|
||||
// Check that the labels were filled
|
||||
for (let labelEl of mutableLabels) {
|
||||
if (!labelEl.textContent) {
|
||||
// This test used to rely on the implied initial timer of
|
||||
// TestUtils.waitForCondition. See bug 1700685.
|
||||
// eslint-disable-next-line mozilla/no-arbitrary-setTimeout
|
||||
await new Promise(resolve => setTimeout(resolve, 10));
|
||||
|
||||
await TestUtils.waitForCondition(
|
||||
() => labelEl.textContent,
|
||||
"Wait for label to be populated by the mutation observer",
|
||||
10
|
||||
);
|
||||
}
|
||||
isnot(
|
||||
labelEl.textContent,
|
||||
"",
|
||||
"Ensure textContent is non-empty for: " + countryOption.value
|
||||
);
|
||||
is(
|
||||
labelEl.dataset.localization,
|
||||
undefined,
|
||||
"Ensure data-localization was removed: " + countryOption.value
|
||||
);
|
||||
}
|
||||
|
||||
let stateOptions = doc.querySelector("#address-level1").options;
|
||||
|
@ -1,122 +0,0 @@
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
## The address and credit card autofill management dialog in browser preferences
|
||||
|
||||
autofill-manage-addresses-title = Saved Addresses
|
||||
autofill-manage-addresses-list-header = Addresses
|
||||
|
||||
autofill-manage-credit-cards-title = Saved Credit Cards
|
||||
autofill-manage-credit-cards-list-header = Credit Cards
|
||||
|
||||
autofill-manage-dialog =
|
||||
.style = min-width: 560px
|
||||
autofill-manage-remove-button = Remove
|
||||
autofill-manage-add-button = Add…
|
||||
autofill-manage-edit-button = Edit…
|
||||
|
||||
##
|
||||
|
||||
# The dialog title for creating addresses in browser preferences.
|
||||
autofill-add-new-address-title = Add New Address
|
||||
# The dialog title for editing addresses in browser preferences.
|
||||
autofill-edit-address-title = Edit Address
|
||||
|
||||
autofill-address-given-name = First Name
|
||||
autofill-address-additional-name = Middle Name
|
||||
autofill-address-family-name = Last Name
|
||||
autofill-address-organization = Organization
|
||||
autofill-address-street = Street Address
|
||||
|
||||
## address-level-3 (Sublocality) names
|
||||
|
||||
# Used in IR, MX
|
||||
autofill-address-neighborhood = Neighborhood
|
||||
# Used in MY
|
||||
autofill-address-village-township = Village or Township
|
||||
autofill-address-island = Island
|
||||
# Used in IE
|
||||
autofill-address-townland = Townland
|
||||
|
||||
## address-level-2 names
|
||||
|
||||
autofill-address-city = City
|
||||
# Used in HK, SD, SY, TR as Address Level-2 and used in KR as Sublocality.
|
||||
autofill-address-district = District
|
||||
# Used in GB, NO, SE
|
||||
autofill-address-post-town = Post town
|
||||
# Used in AU as Address Level-2 and used in ZZ as Sublocality.
|
||||
autofill-address-suburb = Suburb
|
||||
|
||||
## address-level-1 names
|
||||
|
||||
autofill-address-province = Province
|
||||
autofill-address-state = State
|
||||
autofill-address-county = County
|
||||
# Used in BB, JM
|
||||
autofill-address-parish = Parish
|
||||
# Used in JP
|
||||
autofill-address-prefecture = Prefecture
|
||||
# Used in HK
|
||||
autofill-address-area = Area
|
||||
# Used in KR
|
||||
autofill-address-do-si = Do/Si
|
||||
# Used in NI, CO
|
||||
autofill-address-department = Department
|
||||
# Used in AE
|
||||
autofill-address-emirate = Emirate
|
||||
# Used in RU and UA
|
||||
autofill-address-oblast = Oblast
|
||||
|
||||
## Postal code name types
|
||||
|
||||
# Used in IN
|
||||
autofill-address-pin = Pin
|
||||
autofill-address-postal-code = Postal Code
|
||||
autofill-address-zip = ZIP Code
|
||||
# Used in IE
|
||||
autofill-address-eircode = Eircode
|
||||
|
||||
##
|
||||
|
||||
autofill-address-country = Country or Region
|
||||
autofill-address-tel = Phone
|
||||
autofill-address-email = Email
|
||||
|
||||
autofill-cancel-button = Cancel
|
||||
autofill-save-button = Save
|
||||
autofill-country-warning-message = Form Autofill is currently available only for certain countries.
|
||||
|
||||
# The dialog title for creating credit cards in browser preferences.
|
||||
autofill-add-new-card-title = Add New Credit Card
|
||||
# The dialog title for editing credit cards in browser preferences.
|
||||
autofill-edit-card-title = Edit Credit Card
|
||||
|
||||
# In macOS, this string is preceded by the operating system with "Firefox is trying to ",
|
||||
# and has a period added to its end. Make sure to test in your locale.
|
||||
autofill-edit-card-password-prompt = { PLATFORM() ->
|
||||
[macos] show credit card information
|
||||
[windows] { -brand-short-name } is trying to show credit card information. Confirm access to this Windows account below.
|
||||
*[other] { -brand-short-name } is trying to show credit card information.
|
||||
}
|
||||
|
||||
autofill-card-number = Card Number
|
||||
autofill-card-invalid-number = Please enter a valid card number
|
||||
autofill-card-name-on-card = Name on Card
|
||||
autofill-card-expires-month = Exp. Month
|
||||
autofill-card-expires-year = Exp. Year
|
||||
autofill-card-billing-address = Billing Address
|
||||
autofill-card-network = Card Type
|
||||
|
||||
## These are brand names and should only be translated when a locale-specific name for that brand is in common use
|
||||
|
||||
autofill-card-network-amex = American Express
|
||||
autofill-card-network-cartebancaire = Carte Bancaire
|
||||
autofill-card-network-diners = Diners Club
|
||||
autofill-card-network-discover = Discover
|
||||
autofill-card-network-jcb = JCB
|
||||
autofill-card-network-mastercard = MasterCard
|
||||
autofill-card-network-mir = MIR
|
||||
autofill-card-network-unionpay = Union Pay
|
||||
autofill-card-network-visa = Visa
|
@ -274,7 +274,7 @@ Example:
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
let regs = getRegionDisplayNames(["pl"], ["US", "CA", "MX"]);
|
||||
let regs = getLanguageDisplayNames(["pl"], ["US", "CA", "MX"]);
|
||||
regs === ["Stany Zjednoczone", "Kanada", "Meksyk"];
|
||||
|
||||
mozIntl.getLocaleDisplayNames(locales, localeCodes)
|
||||
@ -286,7 +286,7 @@ Example:
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
let locs = getLocaleDisplayNames(["pl"], ["sr-RU", "es-MX", "fr-CA"]);
|
||||
let locs = getLanguageDisplayNames(["pl"], ["sr-RU", "es-MX", "fr-CA"]);
|
||||
locs === ["Serbski (Rosja)", "Hiszpański (Meksyk)", "Francuski (Kanada)"];
|
||||
|
||||
mozIntl.getAvailableLocaleDisplayNames(type)
|
||||
|
@ -1,282 +0,0 @@
|
||||
# Any copyright is dedicated to the Public Domain.
|
||||
# http://creativecommons.org/publicdomain/zero/1.0/
|
||||
|
||||
import fluent.syntax.ast as FTL
|
||||
from fluent.migrate.helpers import TERM_REFERENCE, transforms_from
|
||||
from fluent.migrate.transforms import COPY, REPLACE, Transform
|
||||
|
||||
|
||||
def migrate(ctx):
|
||||
"""Bugs 1446164 & 1786708 - Migrate formautofill dialogs to Fluent, part {index}."""
|
||||
|
||||
source = "browser/extensions/formautofill/formautofill.properties"
|
||||
target = "browser/browser/preferences/formAutofill.ftl"
|
||||
|
||||
ctx.add_transforms(
|
||||
target,
|
||||
target,
|
||||
# Bug 1786708
|
||||
transforms_from(
|
||||
"""
|
||||
autofill-manage-addresses-title = { COPY(source, "manageAddressesTitle") }
|
||||
autofill-manage-credit-cards-title = { COPY(source, "manageCreditCardsTitle") }
|
||||
autofill-manage-addresses-list-header = { COPY(source, "addressesListHeader") }
|
||||
autofill-manage-credit-cards-list-header = { COPY(source, "creditCardsListHeader") }
|
||||
autofill-manage-remove-button = { COPY(source, "removeBtnLabel") }
|
||||
autofill-manage-add-button = { COPY(source, "addBtnLabel") }
|
||||
autofill-manage-edit-button = { COPY(source, "editBtnLabel") }
|
||||
autofill-manage-dialog =
|
||||
.style = min-width: { COPY(source, "manageDialogsWidth") }
|
||||
""",
|
||||
source=source,
|
||||
)
|
||||
+ [
|
||||
FTL.Message(
|
||||
FTL.Identifier("autofill-edit-card-password-prompt"),
|
||||
value=Transform.pattern_of(
|
||||
FTL.SelectExpression(
|
||||
selector=FTL.FunctionReference(
|
||||
id=FTL.Identifier("PLATFORM"), arguments=FTL.CallArguments()
|
||||
),
|
||||
variants=[
|
||||
FTL.Variant(
|
||||
key=FTL.Identifier("macos"),
|
||||
value=COPY(
|
||||
source, "editCreditCardPasswordPrompt.macos"
|
||||
),
|
||||
),
|
||||
FTL.Variant(
|
||||
key=FTL.Identifier("windows"),
|
||||
value=REPLACE(
|
||||
source,
|
||||
"editCreditCardPasswordPrompt.win",
|
||||
{
|
||||
"%1$S": TERM_REFERENCE("brand-short-name"),
|
||||
},
|
||||
),
|
||||
),
|
||||
FTL.Variant(
|
||||
key=FTL.Identifier("other"),
|
||||
value=REPLACE(
|
||||
source,
|
||||
"editCreditCardPasswordPrompt.linux",
|
||||
{
|
||||
"%1$S": TERM_REFERENCE("brand-short-name"),
|
||||
},
|
||||
),
|
||||
default=True,
|
||||
),
|
||||
],
|
||||
)
|
||||
),
|
||||
)
|
||||
]
|
||||
+
|
||||
# Bug 1446164
|
||||
[
|
||||
FTL.Message(
|
||||
id=FTL.Identifier("autofill-add-new-address-title"),
|
||||
value=COPY(source, "addNewAddressTitle"),
|
||||
),
|
||||
FTL.Message(
|
||||
id=FTL.Identifier("autofill-edit-address-title"),
|
||||
value=COPY(source, "editAddressTitle"),
|
||||
),
|
||||
FTL.Message(
|
||||
id=FTL.Identifier("autofill-address-given-name"),
|
||||
value=COPY(source, "givenName"),
|
||||
),
|
||||
FTL.Message(
|
||||
id=FTL.Identifier("autofill-address-additional-name"),
|
||||
value=COPY(source, "additionalName"),
|
||||
),
|
||||
FTL.Message(
|
||||
id=FTL.Identifier("autofill-address-family-name"),
|
||||
value=COPY(source, "familyName"),
|
||||
),
|
||||
FTL.Message(
|
||||
id=FTL.Identifier("autofill-address-organization"),
|
||||
value=COPY(source, "organization2"),
|
||||
),
|
||||
FTL.Message(
|
||||
id=FTL.Identifier("autofill-address-street"),
|
||||
value=COPY(source, "streetAddress"),
|
||||
),
|
||||
FTL.Message(
|
||||
id=FTL.Identifier("autofill-address-neighborhood"),
|
||||
value=COPY(source, "neighborhood"),
|
||||
),
|
||||
FTL.Message(
|
||||
id=FTL.Identifier("autofill-address-village-township"),
|
||||
value=COPY(source, "village_township"),
|
||||
),
|
||||
FTL.Message(
|
||||
id=FTL.Identifier("autofill-address-island"),
|
||||
value=COPY(source, "island"),
|
||||
),
|
||||
FTL.Message(
|
||||
id=FTL.Identifier("autofill-address-townland"),
|
||||
value=COPY(source, "townland"),
|
||||
),
|
||||
FTL.Message(
|
||||
id=FTL.Identifier("autofill-address-city"), value=COPY(source, "city")
|
||||
),
|
||||
FTL.Message(
|
||||
id=FTL.Identifier("autofill-address-district"),
|
||||
value=COPY(source, "district"),
|
||||
),
|
||||
FTL.Message(
|
||||
id=FTL.Identifier("autofill-address-post-town"),
|
||||
value=COPY(source, "post_town"),
|
||||
),
|
||||
FTL.Message(
|
||||
id=FTL.Identifier("autofill-address-suburb"),
|
||||
value=COPY(source, "suburb"),
|
||||
),
|
||||
FTL.Message(
|
||||
id=FTL.Identifier("autofill-address-province"),
|
||||
value=COPY(source, "province"),
|
||||
),
|
||||
FTL.Message(
|
||||
id=FTL.Identifier("autofill-address-state"), value=COPY(source, "state")
|
||||
),
|
||||
FTL.Message(
|
||||
id=FTL.Identifier("autofill-address-county"),
|
||||
value=COPY(source, "county"),
|
||||
),
|
||||
FTL.Message(
|
||||
id=FTL.Identifier("autofill-address-parish"),
|
||||
value=COPY(source, "parish"),
|
||||
),
|
||||
FTL.Message(
|
||||
id=FTL.Identifier("autofill-address-prefecture"),
|
||||
value=COPY(source, "prefecture"),
|
||||
),
|
||||
FTL.Message(
|
||||
id=FTL.Identifier("autofill-address-area"), value=COPY(source, "area")
|
||||
),
|
||||
FTL.Message(
|
||||
id=FTL.Identifier("autofill-address-do-si"), value=COPY(source, "do_si")
|
||||
),
|
||||
FTL.Message(
|
||||
id=FTL.Identifier("autofill-address-department"),
|
||||
value=COPY(source, "department"),
|
||||
),
|
||||
FTL.Message(
|
||||
id=FTL.Identifier("autofill-address-emirate"),
|
||||
value=COPY(source, "emirate"),
|
||||
),
|
||||
FTL.Message(
|
||||
id=FTL.Identifier("autofill-address-oblast"),
|
||||
value=COPY(source, "oblast"),
|
||||
),
|
||||
FTL.Message(
|
||||
id=FTL.Identifier("autofill-address-pin"), value=COPY(source, "pin")
|
||||
),
|
||||
FTL.Message(
|
||||
id=FTL.Identifier("autofill-address-postal-code"),
|
||||
value=COPY(source, "postalCode"),
|
||||
),
|
||||
FTL.Message(
|
||||
id=FTL.Identifier("autofill-address-zip"), value=COPY(source, "zip")
|
||||
),
|
||||
FTL.Message(
|
||||
id=FTL.Identifier("autofill-address-eircode"),
|
||||
value=COPY(source, "eircode"),
|
||||
),
|
||||
FTL.Message(
|
||||
id=FTL.Identifier("autofill-address-country"),
|
||||
value=COPY(source, "country"),
|
||||
),
|
||||
FTL.Message(
|
||||
id=FTL.Identifier("autofill-address-tel"), value=COPY(source, "tel")
|
||||
),
|
||||
FTL.Message(
|
||||
id=FTL.Identifier("autofill-address-email"), value=COPY(source, "email")
|
||||
),
|
||||
FTL.Message(
|
||||
id=FTL.Identifier("autofill-cancel-button"),
|
||||
value=COPY(source, "cancelBtnLabel"),
|
||||
),
|
||||
FTL.Message(
|
||||
id=FTL.Identifier("autofill-save-button"),
|
||||
value=COPY(source, "saveBtnLabel"),
|
||||
),
|
||||
FTL.Message(
|
||||
id=FTL.Identifier("autofill-country-warning-message"),
|
||||
value=COPY(source, "countryWarningMessage2"),
|
||||
),
|
||||
FTL.Message(
|
||||
id=FTL.Identifier("autofill-add-new-card-title"),
|
||||
value=COPY(source, "addNewCreditCardTitle"),
|
||||
),
|
||||
FTL.Message(
|
||||
id=FTL.Identifier("autofill-edit-card-title"),
|
||||
value=COPY(source, "editCreditCardTitle"),
|
||||
),
|
||||
FTL.Message(
|
||||
id=FTL.Identifier("autofill-card-number"),
|
||||
value=COPY(source, "cardNumber"),
|
||||
),
|
||||
FTL.Message(
|
||||
id=FTL.Identifier("autofill-card-invalid-number"),
|
||||
value=COPY(source, "invalidCardNumber"),
|
||||
),
|
||||
FTL.Message(
|
||||
id=FTL.Identifier("autofill-card-name-on-card"),
|
||||
value=COPY(source, "nameOnCard"),
|
||||
),
|
||||
FTL.Message(
|
||||
id=FTL.Identifier("autofill-card-expires-month"),
|
||||
value=COPY(source, "cardExpiresMonth"),
|
||||
),
|
||||
FTL.Message(
|
||||
id=FTL.Identifier("autofill-card-expires-year"),
|
||||
value=COPY(source, "cardExpiresYear"),
|
||||
),
|
||||
FTL.Message(
|
||||
id=FTL.Identifier("autofill-card-billing-address"),
|
||||
value=COPY(source, "billingAddress"),
|
||||
),
|
||||
FTL.Message(
|
||||
id=FTL.Identifier("autofill-card-network"),
|
||||
value=COPY(source, "cardNetwork"),
|
||||
),
|
||||
FTL.Message(
|
||||
id=FTL.Identifier("autofill-card-network-amex"),
|
||||
value=COPY(source, "cardNetwork.amex"),
|
||||
),
|
||||
FTL.Message(
|
||||
id=FTL.Identifier("autofill-card-network-cartebancaire"),
|
||||
value=COPY(source, "cardNetwork.cartebancaire"),
|
||||
),
|
||||
FTL.Message(
|
||||
id=FTL.Identifier("autofill-card-network-diners"),
|
||||
value=COPY(source, "cardNetwork.diners"),
|
||||
),
|
||||
FTL.Message(
|
||||
id=FTL.Identifier("autofill-card-network-discover"),
|
||||
value=COPY(source, "cardNetwork.discover"),
|
||||
),
|
||||
FTL.Message(
|
||||
id=FTL.Identifier("autofill-card-network-jcb"),
|
||||
value=COPY(source, "cardNetwork.jcb"),
|
||||
),
|
||||
FTL.Message(
|
||||
id=FTL.Identifier("autofill-card-network-mastercard"),
|
||||
value=COPY(source, "cardNetwork.mastercard"),
|
||||
),
|
||||
FTL.Message(
|
||||
id=FTL.Identifier("autofill-card-network-mir"),
|
||||
value=COPY(source, "cardNetwork.mir"),
|
||||
),
|
||||
FTL.Message(
|
||||
id=FTL.Identifier("autofill-card-network-unionpay"),
|
||||
value=COPY(source, "cardNetwork.unionpay"),
|
||||
),
|
||||
FTL.Message(
|
||||
id=FTL.Identifier("autofill-card-network-visa"),
|
||||
value=COPY(source, "cardNetwork.visa"),
|
||||
),
|
||||
],
|
||||
)
|
@ -40,10 +40,10 @@ const {
|
||||
ENABLED_AUTOFILL_CREDITCARDS_REAUTH_PREF,
|
||||
} = FormAutofill;
|
||||
const {
|
||||
MANAGE_ADDRESSES_L10N_IDS,
|
||||
EDIT_ADDRESS_L10N_IDS,
|
||||
MANAGE_CREDITCARDS_L10N_IDS,
|
||||
EDIT_CREDITCARD_L10N_IDS,
|
||||
MANAGE_ADDRESSES_KEYWORDS,
|
||||
EDIT_ADDRESS_KEYWORDS,
|
||||
MANAGE_CREDITCARDS_KEYWORDS,
|
||||
EDIT_CREDITCARD_KEYWORDS,
|
||||
} = FormAutofillUtils;
|
||||
// Add credit card enabled flag in telemetry environment for recording the number of
|
||||
// users who disable/enable the credit card autofill feature.
|
||||
@ -148,8 +148,10 @@ FormAutofillPreferences.prototype = {
|
||||
|
||||
// Add preferences search support
|
||||
savedAddressesBtn.setAttribute(
|
||||
"search-l10n-ids",
|
||||
MANAGE_ADDRESSES_L10N_IDS.concat(EDIT_ADDRESS_L10N_IDS).join(",")
|
||||
"searchkeywords",
|
||||
MANAGE_ADDRESSES_KEYWORDS.concat(EDIT_ADDRESS_KEYWORDS)
|
||||
.map(key => this.bundle.GetStringFromName(key))
|
||||
.join("\n")
|
||||
);
|
||||
|
||||
// Manually set the checked state
|
||||
@ -216,8 +218,10 @@ FormAutofillPreferences.prototype = {
|
||||
|
||||
// Add preferences search support
|
||||
savedCreditCardsBtn.setAttribute(
|
||||
"search-l10n-ids",
|
||||
MANAGE_CREDITCARDS_L10N_IDS.concat(EDIT_CREDITCARD_L10N_IDS).join(",")
|
||||
"searchkeywords",
|
||||
MANAGE_CREDITCARDS_KEYWORDS.concat(EDIT_CREDITCARD_KEYWORDS)
|
||||
.map(key => this.bundle.GetStringFromName(key))
|
||||
.join("\n")
|
||||
);
|
||||
|
||||
// Manually set the checked state
|
||||
|
@ -17,35 +17,35 @@ const ADDRESS_REFERENCES_EXT = "addressReferencesExt.js";
|
||||
|
||||
const ADDRESSES_COLLECTION_NAME = "addresses";
|
||||
const CREDITCARDS_COLLECTION_NAME = "creditCards";
|
||||
const MANAGE_ADDRESSES_L10N_IDS = [
|
||||
"autofill-add-new-address-title",
|
||||
"autofill-manage-addresses-title",
|
||||
const MANAGE_ADDRESSES_KEYWORDS = [
|
||||
"manageAddressesTitle",
|
||||
"addNewAddressTitle",
|
||||
];
|
||||
const EDIT_ADDRESS_L10N_IDS = [
|
||||
"autofill-address-given-name",
|
||||
"autofill-address-additional-name",
|
||||
"autofill-address-family-name",
|
||||
"autofill-address-organization",
|
||||
"autofill-address-street",
|
||||
"autofill-address-state",
|
||||
"autofill-address-province",
|
||||
"autofill-address-city",
|
||||
"autofill-address-country",
|
||||
"autofill-address-zip",
|
||||
"autofill-address-postal-code",
|
||||
"autofill-address-email",
|
||||
"autofill-address-tel",
|
||||
const EDIT_ADDRESS_KEYWORDS = [
|
||||
"givenName",
|
||||
"additionalName",
|
||||
"familyName",
|
||||
"organization2",
|
||||
"streetAddress",
|
||||
"state",
|
||||
"province",
|
||||
"city",
|
||||
"country",
|
||||
"zip",
|
||||
"postalCode",
|
||||
"email",
|
||||
"tel",
|
||||
];
|
||||
const MANAGE_CREDITCARDS_L10N_IDS = [
|
||||
"autofill-add-new-card-title",
|
||||
"autofill-manage-credit-cards-title",
|
||||
const MANAGE_CREDITCARDS_KEYWORDS = [
|
||||
"manageCreditCardsTitle",
|
||||
"addNewCreditCardTitle",
|
||||
];
|
||||
const EDIT_CREDITCARD_L10N_IDS = [
|
||||
"autofill-card-number",
|
||||
"autofill-card-name-on-card",
|
||||
"autofill-card-expires-month",
|
||||
"autofill-card-expires-year",
|
||||
"autofill-card-network",
|
||||
const EDIT_CREDITCARD_KEYWORDS = [
|
||||
"cardNumber",
|
||||
"nameOnCard",
|
||||
"cardExpiresMonth",
|
||||
"cardExpiresYear",
|
||||
"cardNetwork",
|
||||
];
|
||||
const FIELD_STATES = {
|
||||
NORMAL: "NORMAL",
|
||||
@ -221,10 +221,10 @@ FormAutofillUtils = {
|
||||
|
||||
ADDRESSES_COLLECTION_NAME,
|
||||
CREDITCARDS_COLLECTION_NAME,
|
||||
MANAGE_ADDRESSES_L10N_IDS,
|
||||
EDIT_ADDRESS_L10N_IDS,
|
||||
MANAGE_CREDITCARDS_L10N_IDS,
|
||||
EDIT_CREDITCARD_L10N_IDS,
|
||||
MANAGE_ADDRESSES_KEYWORDS,
|
||||
EDIT_ADDRESS_KEYWORDS,
|
||||
MANAGE_CREDITCARDS_KEYWORDS,
|
||||
EDIT_CREDITCARD_KEYWORDS,
|
||||
MAX_FIELD_VALUE_LENGTH,
|
||||
FIELD_STATES,
|
||||
SECTION_TYPES,
|
||||
@ -1067,10 +1067,10 @@ FormAutofillUtils = {
|
||||
* @param {string} country
|
||||
* @returns {object}
|
||||
* {
|
||||
* {string} addressLevel3L10nId
|
||||
* {string} addressLevel2L10nId
|
||||
* {string} addressLevel1L10nId
|
||||
* {string} postalCodeL10nId
|
||||
* {string} addressLevel3Label
|
||||
* {string} addressLevel2Label
|
||||
* {string} addressLevel1Label
|
||||
* {string} postalCodeLabel
|
||||
* {object} fieldsOrder
|
||||
* {string} postalCodePattern
|
||||
* }
|
||||
@ -1094,15 +1094,9 @@ FormAutofillUtils = {
|
||||
// When particular values are missing for a country, the
|
||||
// data/ZZ value should be used instead:
|
||||
// https://chromium-i18n.appspot.com/ssl-aggregate-address/data/ZZ
|
||||
addressLevel3L10nId: this.getAddressFieldL10nId(
|
||||
dataset.sublocality_name_type || "suburb"
|
||||
),
|
||||
addressLevel2L10nId: this.getAddressFieldL10nId(
|
||||
dataset.locality_name_type || "city"
|
||||
),
|
||||
addressLevel1L10nId: this.getAddressFieldL10nId(
|
||||
dataset.state_name_type || "province"
|
||||
),
|
||||
addressLevel3Label: dataset.sublocality_name_type || "suburb",
|
||||
addressLevel2Label: dataset.locality_name_type || "city",
|
||||
addressLevel1Label: dataset.state_name_type || "province",
|
||||
addressLevel1Options: this.buildRegionMapIfAvailable(
|
||||
dataset.sub_keys,
|
||||
dataset.sub_isoids,
|
||||
@ -1111,15 +1105,52 @@ FormAutofillUtils = {
|
||||
),
|
||||
countryRequiredFields: this.parseRequireString(dataset.require || "AC"),
|
||||
fieldsOrder: this.parseAddressFormat(dataset.fmt || "%N%n%O%n%A%n%C"),
|
||||
postalCodeL10nId: this.getAddressFieldL10nId(
|
||||
dataset.zip_name_type || "postal-code"
|
||||
),
|
||||
postalCodeLabel: dataset.zip_name_type || "postalCode",
|
||||
postalCodePattern: dataset.zip,
|
||||
};
|
||||
},
|
||||
|
||||
getAddressFieldL10nId(type) {
|
||||
return "autofill-address-" + type.replace(/_/g, "-");
|
||||
/**
|
||||
* Localize "data-localization" or "data-localization-region" attributes.
|
||||
* @param {Element} element
|
||||
* @param {string} attributeName
|
||||
*/
|
||||
localizeAttributeForElement(element, attributeName) {
|
||||
switch (attributeName) {
|
||||
case "data-localization": {
|
||||
element.textContent = this.stringBundle.GetStringFromName(
|
||||
element.getAttribute(attributeName)
|
||||
);
|
||||
element.removeAttribute(attributeName);
|
||||
break;
|
||||
}
|
||||
case "data-localization-region": {
|
||||
let regionCode = element.getAttribute(attributeName);
|
||||
element.textContent = Services.intl.getRegionDisplayNames(undefined, [
|
||||
regionCode,
|
||||
]);
|
||||
element.removeAttribute(attributeName);
|
||||
return;
|
||||
}
|
||||
default:
|
||||
throw new Error("Unexpected attributeName");
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Localize elements with "data-localization" or "data-localization-region" attributes.
|
||||
* @param {Element} root
|
||||
*/
|
||||
localizeMarkup(root) {
|
||||
let elements = root.querySelectorAll("[data-localization]");
|
||||
for (let element of elements) {
|
||||
this.localizeAttributeForElement(element, "data-localization");
|
||||
}
|
||||
|
||||
elements = root.querySelectorAll("[data-localization-region]");
|
||||
for (let element of elements) {
|
||||
this.localizeAttributeForElement(element, "data-localization-region");
|
||||
}
|
||||
},
|
||||
|
||||
CC_FATHOM_NONE: 0,
|
||||
|
@ -15,12 +15,6 @@ XPCOMUtils.defineLazyModuleGetters(lazy, {
|
||||
FormAutofillUtils: "resource://autofill/FormAutofillUtils.jsm",
|
||||
});
|
||||
|
||||
XPCOMUtils.defineLazyGetter(
|
||||
lazy,
|
||||
"l10n",
|
||||
() => new Localization(["browser/preferences/formAutofill.ftl"], true)
|
||||
);
|
||||
|
||||
class ProfileAutoCompleteResult {
|
||||
constructor(
|
||||
searchString,
|
||||
@ -422,9 +416,14 @@ class CreditCardResult extends ProfileAutoCompleteResult {
|
||||
// The card type is displayed visually using an image. For a11y, we need
|
||||
// to expose it as text. We do this using aria-label. However,
|
||||
// aria-label overrides the text content, so we must include that also.
|
||||
let ccTypeName = lazy.l10n.formatValueSync(
|
||||
`autofill-card-network-${profile["cc-type"]}`
|
||||
);
|
||||
let ccTypeName;
|
||||
try {
|
||||
ccTypeName = lazy.FormAutofillUtils.stringBundle.GetStringFromName(
|
||||
`cardNetwork.${profile["cc-type"]}`
|
||||
);
|
||||
} catch (e) {
|
||||
ccTypeName = null; // Unknown.
|
||||
}
|
||||
const ariaLabel = [ccTypeName, primaryAffix, primary, secondary]
|
||||
.filter(chunk => !!chunk) // Exclude empty chunks.
|
||||
.join(" ");
|
||||
|
@ -383,9 +383,19 @@ let FormAutofillPrompter = {
|
||||
creditCard.record["cc-number"] ||
|
||||
creditCard.record["cc-number-decrypted"];
|
||||
let name = creditCard.record["cc-name"];
|
||||
let month = creditCard.record["cc-exp-month"];
|
||||
let year = creditCard.record["cc-exp-year"];
|
||||
let type = lazy.CreditCard.getType(number);
|
||||
let maskedNumber = lazy.CreditCard.getMaskedNumber(number);
|
||||
let description = `${maskedNumber}, ${name}`;
|
||||
let ccLabelInfo = lazy.CreditCard.getLabelInfo({
|
||||
number,
|
||||
name,
|
||||
month,
|
||||
year,
|
||||
type,
|
||||
});
|
||||
let description = [ccLabelInfo.args.number, ccLabelInfo.args.name].join(
|
||||
", "
|
||||
);
|
||||
const telemetryObject = creditCard.guid
|
||||
? "update_doorhanger"
|
||||
: "capture_doorhanger";
|
||||
|
Loading…
Reference in New Issue
Block a user