Index: third_party/WebKit/Source/modules/payments/PaymentRequest.cpp |
diff --git a/third_party/WebKit/Source/modules/payments/PaymentRequest.cpp b/third_party/WebKit/Source/modules/payments/PaymentRequest.cpp |
index c0704ba17b4e4039b216dfeff3b8450e9aba9930..e123a0d4a120ac39908d7a9103a06ad8b7209d7c 100644 |
--- a/third_party/WebKit/Source/modules/payments/PaymentRequest.cpp |
+++ b/third_party/WebKit/Source/modules/payments/PaymentRequest.cpp |
@@ -125,6 +125,11 @@ struct TypeConverter<PaymentDetailsPtr, blink::PaymentDetails> { |
else |
output->modifiers = mojo::WTFArray<PaymentDetailsModifierPtr>::New(0); |
+ if (input.hasError()) |
+ output->error = input.error(); |
+ else |
+ output->error = WTF::emptyString(); |
+ |
return output; |
} |
}; |
@@ -304,6 +309,12 @@ void validatePaymentDetails(const PaymentDetails& details, ExceptionState& excep |
if (details.hasModifiers()) { |
validatePaymentDetailsModifiers(details.modifiers(), exceptionState); |
} |
+ |
+ String errorMessage; |
+ if (!PaymentsValidators::isValidErrorMsgFormat(details.error(), &errorMessage)) { |
+ exceptionState.throwTypeError(errorMessage); |
+ return; |
+ } |
} |
void validateAndConvertPaymentMethodData(const HeapVector<PaymentMethodData>& paymentMethodData, Vector<PaymentRequest::MethodData>* methodData, ExceptionState& exceptionState) |
@@ -534,6 +545,11 @@ PaymentRequest::PaymentRequest(ScriptState* scriptState, const HeapVector<Paymen |
if (exceptionState.hadException()) |
return; |
+ if (details.hasError() && !details.error().isEmpty()) { |
+ exceptionState.throwTypeError("Error value should be empty"); |
+ return; |
+ } |
+ |
if (m_options.requestShipping()) { |
m_shippingOption = getSelectedShippingOption(details); |
m_shippingType = getValidShippingType(m_options.shippingType()); |