| 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..294efb8b5f8874240c440db7441eca8782220154 100644
|
| --- a/third_party/WebKit/Source/modules/payments/PaymentRequest.cpp
|
| +++ b/third_party/WebKit/Source/modules/payments/PaymentRequest.cpp
|
| @@ -25,6 +25,7 @@
|
| #include "mojo/public/cpp/bindings/wtf_array.h"
|
| #include "platform/mojo/MojoHelper.h"
|
| #include "public/platform/ServiceRegistry.h"
|
| +#include "wtf/HashSet.h"
|
| #include <utility>
|
|
|
| namespace mojo {
|
| @@ -224,11 +225,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;
|
| }
|
| + 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()) {
|
| validateShippingOptionOrPaymentItem(modifier.total(), exceptionState);
|
| @@ -289,11 +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;
|
| }
|
| + 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 = "";
|
| if (pmd.hasData() && !pmd.data().isEmpty()) {
|
|
|