Backed out changeset a6973ffa879c (bug 1371113)

This commit is contained in:
Sebastian Hengst 2017-08-28 13:32:52 +02:00
Родитель 6b75fc55d8
Коммит 1b8354c393
2 изменённых файлов: 5 добавлений и 38 удалений

Просмотреть файл

@ -563,9 +563,8 @@ FormAutofillHandler.prototype = {
delete data.address;
}
if (data.creditCard && (!data.creditCard.record["cc-number"] ||
!FormAutofillUtils.isCCNumber(data.creditCard.record["cc-number"]))) {
log.debug("No credit card record saving since card number is invalid");
if (data.creditCard && !data.creditCard.record["cc-number"]) {
log.debug("No credit card record saving since card number is empty");
delete data.creditCard;
}

Просмотреть файл

@ -355,7 +355,9 @@ FormAutofillParent.prototype = {
this._updateStatus();
},
_onAddressSubmit(address, target) {
_onFormSubmit(data, target) {
let {address} = data;
if (address.guid) {
// Avoid updating the fields that users don't modify.
let originalAddress = this.profileStorage.addresses.get(address.guid);
@ -416,38 +418,4 @@ FormAutofillParent.prototype = {
}
}
},
async _onCreditCardSubmit(creditCard, target) {
// We'll show the credit card doorhanger if:
// - User applys autofill and changed
// - User fills form manually
if (creditCard.guid &&
Object.keys(creditCard.record).every(key => creditCard.untouchedFields.includes(key))) {
return;
}
let state = await FormAutofillDoorhanger.show(target, "creditCard");
if (state == "cancel") {
return;
}
if (state == "disable") {
Services.prefs.setBoolPref("extensions.formautofill.creditCards.enabled", false);
return;
}
await this.profileStorage.creditCards.normalizeCCNumberFields(creditCard.record);
this.profileStorage.creditCards.add(creditCard.record);
},
_onFormSubmit(data, target) {
let {address, creditCard} = data;
if (address) {
this._onAddressSubmit(address, target);
}
if (creditCard) {
this._onCreditCardSubmit(creditCard, target);
}
},
};