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

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

Issue 2830683002: Log duplicate shipping option ID warning in web payments API. (Closed)
Patch Set: Fix test Created 3 years, 8 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
« no previous file with comments | « third_party/WebKit/LayoutTests/payments/payment-request-interface-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 e517e71e3e26d6b59b090553dcefd9581db49931..f7d0b88c740f0eeea5d10817b22fabffb53a3588 100644
--- a/third_party/WebKit/Source/modules/payments/PaymentRequest.cpp
+++ b/third_party/WebKit/Source/modules/payments/PaymentRequest.cpp
@@ -186,6 +186,7 @@ void ValidateAndConvertDisplayItems(const HeapVector<PaymentItem>& input,
void ValidateAndConvertShippingOptions(
const HeapVector<PaymentShippingOption>& input,
Vector<PaymentShippingOptionPtr>& output,
+ ExecutionContext& execution_context,
ExceptionState& exception_state) {
HashSet<String> unique_ids;
for (const PaymentShippingOption& option : input) {
@@ -195,6 +196,10 @@ void ValidateAndConvertShippingOptions(
}
if (unique_ids.Contains(option.id())) {
+ execution_context.AddConsoleMessage(ConsoleMessage::Create(
+ kJSMessageSource, kWarningMessageLevel,
+ "Duplicate shipping option identifier '" + option.id() +
+ "' is treated as an invalid address indicator."));
// Clear |output| instead of throwing an exception.
output.clear();
return;
@@ -492,8 +497,9 @@ void ValidateAndConvertPaymentDetailsBase(const PaymentDetailsBase& input,
}
if (input.hasShippingOptions() && request_shipping) {
- ValidateAndConvertShippingOptions(
- input.shippingOptions(), output->shipping_options, exception_state);
+ ValidateAndConvertShippingOptions(input.shippingOptions(),
+ output->shipping_options,
+ execution_context, exception_state);
if (exception_state.HadException())
return;
}
« no previous file with comments | « third_party/WebKit/LayoutTests/payments/payment-request-interface-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698