Chromium Code Reviews| 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 e3da8a51339833091acfc3cae2bc2ca25a1ecf31..2c5983de3ba29908cd09bc38f19e2d1a2ad32fa9 100644 |
| --- a/third_party/WebKit/Source/modules/payments/PaymentRequest.cpp |
| +++ b/third_party/WebKit/Source/modules/payments/PaymentRequest.cpp |
| @@ -224,10 +224,19 @@ void validatePaymentDetailsModifiers(const HeapVector<PaymentDetailsModifier>& m |
| return; |
| } |
| + HashSet<String> uniqueMethods; |
| for (const auto& modifier : modifiers) { |
| if (modifier.supportedMethods().isEmpty()) { |
| exceptionState.throwTypeError("Must specify at least one payment method identifier"); |
| return; |
| + } else { |
|
please use gerrit instead
2016/07/06 07:31:56
No need for "else", because the previous clause re
pals
2016/07/07 05:14:13
Done.
|
| + for (const auto& method : modifier.supportedMethods()) { |
| + if (uniqueMethods.contains(method)) { |
| + exceptionState.throwTypeError("Duplicate payment method identifiers are not allowed"); |
| + return; |
| + } |
| + uniqueMethods.add(method); |
| + } |
| } |
| if (modifier.hasTotal()) { |
| @@ -289,10 +298,19 @@ void validateAndConvertPaymentMethodData(const HeapVector<PaymentMethodData>& pa |
| return; |
| } |
| + HashSet<String> uniqueMethods; |
| for (const auto& pmd : paymentMethodData) { |
| if (pmd.supportedMethods().isEmpty()) { |
| exceptionState.throwTypeError("Must specify at least one payment method identifier"); |
| return; |
| + } else { |
|
please use gerrit instead
2016/07/06 07:31:56
Ditto.
pals
2016/07/07 05:14:13
Done.
|
| + for (const auto& method : pmd.supportedMethods()) { |
| + if (uniqueMethods.contains(method)) { |
| + exceptionState.throwTypeError("Duplicate payment method identifiers are not allowed"); |
| + return; |
| + } |
| + uniqueMethods.add(method); |
| + } |
| } |
| String stringifiedData = ""; |