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

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

Issue 2137953002: Duplicate shipping option identifiers should throw TypeError. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: patch2 Created 4 years, 5 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 386f630876a9c71a1349abdb661c91fee410b93f..106a1ef683bf74c246ec1c420579a8aa666e5ea1 100644
--- a/third_party/WebKit/Source/modules/payments/PaymentRequest.cpp
+++ b/third_party/WebKit/Source/modules/payments/PaymentRequest.cpp
@@ -206,11 +206,17 @@ void validateDisplayItems(const HeapVector<PaymentItem>& items, ExceptionState&
void validateShippingOptions(const HeapVector<PaymentShippingOption>& options, ExceptionState& exceptionState)
{
+ HashSet<String> uniqueIds;
for (const auto& option : options) {
if (!option.hasId() || option.id().isEmpty()) {
exceptionState.throwTypeError("ShippingOption id required");
return;
}
please use gerrit instead 2016/07/12 10:01:16 nit: newline between the blocks.
+ if (uniqueIds.contains(option.id())) {
+ exceptionState.throwTypeError("Duplicate shipping option identifiers are not allowed");
+ return;
+ }
+ uniqueIds.add(option.id());
validateShippingOptionOrPaymentItem(option, exceptionState);
if (exceptionState.hadException())

Powered by Google App Engine
This is Rietveld 408576698