Bug 1538526 - Set BasicCardResponse defaults in IDL. r=baku

update to match spec. This is a refactor.

Differential Revision: https://phabricator.services.mozilla.com/D24638

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Marcos Cáceres 2019-03-25 23:40:23 +00:00
Родитель cfc1229145
Коммит 836cdca53a
3 изменённых файлов: 13 добавлений и 19 удалений

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

@ -121,8 +121,7 @@ void PaymentMethodChangeEvent::GetMethodDetails(
!rawDetails.billingAddress.phone.IsEmpty()) {
nsCOMPtr<nsPIDOMWindowInner> window =
do_QueryInterface(GetParentObject());
basicCardDetails.mBillingAddress.Construct();
basicCardDetails.mBillingAddress.Value() =
basicCardDetails.mBillingAddress =
new PaymentAddress(window, rawDetails.billingAddress.country,
rawDetails.billingAddress.addressLine,
rawDetails.billingAddress.region,

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

@ -97,21 +97,17 @@ void PaymentResponse::GetDetails(JSContext* aCx,
const BasicCardData& rawData = mDetails.basicCardData();
BasicCardResponse basicCardResponse;
if (!rawData.cardholderName.IsEmpty()) {
basicCardResponse.mCardholderName.Construct();
basicCardResponse.mCardholderName.Value() = rawData.cardholderName;
basicCardResponse.mCardholderName = rawData.cardholderName;
}
basicCardResponse.mCardNumber = rawData.cardNumber;
if (!rawData.expiryMonth.IsEmpty()) {
basicCardResponse.mExpiryMonth.Construct();
basicCardResponse.mExpiryMonth.Value() = rawData.expiryMonth;
basicCardResponse.mExpiryMonth = rawData.expiryMonth;
}
if (!rawData.expiryYear.IsEmpty()) {
basicCardResponse.mExpiryYear.Construct();
basicCardResponse.mExpiryYear.Value() = rawData.expiryYear;
basicCardResponse.mExpiryYear = rawData.expiryYear;
}
if (!rawData.cardSecurityCode.IsEmpty()) {
basicCardResponse.mCardSecurityCode.Construct();
basicCardResponse.mCardSecurityCode.Value() = rawData.cardSecurityCode;
basicCardResponse.mCardSecurityCode = rawData.cardSecurityCode;
}
if (!rawData.billingAddress.country.IsEmpty() ||
!rawData.billingAddress.addressLine.IsEmpty() ||
@ -124,8 +120,7 @@ void PaymentResponse::GetDetails(JSContext* aCx,
!rawData.billingAddress.organization.IsEmpty() ||
!rawData.billingAddress.recipient.IsEmpty() ||
!rawData.billingAddress.phone.IsEmpty()) {
basicCardResponse.mBillingAddress.Construct();
basicCardResponse.mBillingAddress.Value() = new PaymentAddress(
basicCardResponse.mBillingAddress = new PaymentAddress(
GetOwner(), rawData.billingAddress.country,
rawData.billingAddress.addressLine, rawData.billingAddress.region,
rawData.billingAddress.regionCode, rawData.billingAddress.city,

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

@ -4,7 +4,7 @@
* You can obtain one at http://mozilla.org/MPL/2.0/.
*
* The origin of this WebIDL file is
* https://www.w3.org/TR/payment-request/#paymentrequest-interface
* https://www.w3.org/TR/payment-method-basic-card/
*/
dictionary BasicCardRequest {
@ -12,16 +12,16 @@ dictionary BasicCardRequest {
};
dictionary BasicCardResponse {
DOMString cardholderName;
DOMString cardholderName = "";
required DOMString cardNumber;
DOMString expiryMonth;
DOMString expiryYear;
DOMString cardSecurityCode;
PaymentAddress? billingAddress;
DOMString expiryMonth = "";
DOMString expiryYear = "";
DOMString cardSecurityCode = "";
PaymentAddress? billingAddress = null;
};
dictionary BasicCardChangeDetails {
PaymentAddress? billingAddress;
PaymentAddress? billingAddress = null;
};
dictionary BasicCardErrors {