Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(388)

Unified Diff: third_party/WebKit/Source/modules/payments/PaymentRequest.cpp

Issue 2355463002: [PaymentReqeust] Add error message in PaymentDetails. (in blink side) (Closed)
Patch Set: [PaymentReqeust] Add error message in PaymentDetails. (in blink side) Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 0adcb7c08c18fef7a5854aad5bb668a64e8c21d6..fe84aca14add17eb173ed63ab0653d55be4b7ac0 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;
}
};
@@ -519,6 +524,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);

Powered by Google App Engine
This is Rietveld 408576698