OLD | NEW |
---|---|
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "modules/payments/PaymentRequest.h" | 5 #include "modules/payments/PaymentRequest.h" |
6 | 6 |
7 #include "bindings/core/v8/ExceptionState.h" | 7 #include "bindings/core/v8/ExceptionState.h" |
8 #include "bindings/core/v8/JSONValuesForV8.h" | 8 #include "bindings/core/v8/JSONValuesForV8.h" |
9 #include "bindings/core/v8/ScriptPromiseResolver.h" | 9 #include "bindings/core/v8/ScriptPromiseResolver.h" |
10 #include "bindings/core/v8/ScriptState.h" | 10 #include "bindings/core/v8/ScriptState.h" |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
199 { | 199 { |
200 for (const auto& item : items) { | 200 for (const auto& item : items) { |
201 validateShippingOptionOrPaymentItem(item, exceptionState); | 201 validateShippingOptionOrPaymentItem(item, exceptionState); |
202 if (exceptionState.hadException()) | 202 if (exceptionState.hadException()) |
203 return; | 203 return; |
204 } | 204 } |
205 } | 205 } |
206 | 206 |
207 void validateShippingOptions(const HeapVector<PaymentShippingOption>& options, E xceptionState& exceptionState) | 207 void validateShippingOptions(const HeapVector<PaymentShippingOption>& options, E xceptionState& exceptionState) |
208 { | 208 { |
209 HashSet<String> uniqueIds; | |
209 for (const auto& option : options) { | 210 for (const auto& option : options) { |
210 if (!option.hasId() || option.id().isEmpty()) { | 211 if (!option.hasId() || option.id().isEmpty()) { |
211 exceptionState.throwTypeError("ShippingOption id required"); | 212 exceptionState.throwTypeError("ShippingOption id required"); |
212 return; | 213 return; |
213 } | 214 } |
please use gerrit instead
2016/07/12 10:01:16
nit: newline between the blocks.
| |
215 if (uniqueIds.contains(option.id())) { | |
216 exceptionState.throwTypeError("Duplicate shipping option identifiers are not allowed"); | |
217 return; | |
218 } | |
219 uniqueIds.add(option.id()); | |
214 | 220 |
215 validateShippingOptionOrPaymentItem(option, exceptionState); | 221 validateShippingOptionOrPaymentItem(option, exceptionState); |
216 if (exceptionState.hadException()) | 222 if (exceptionState.hadException()) |
217 return; | 223 return; |
218 } | 224 } |
219 } | 225 } |
220 | 226 |
221 void validatePaymentDetailsModifiers(const HeapVector<PaymentDetailsModifier>& m odifiers, ExceptionState& exceptionState) | 227 void validatePaymentDetailsModifiers(const HeapVector<PaymentDetailsModifier>& m odifiers, ExceptionState& exceptionState) |
222 { | 228 { |
223 if (modifiers.isEmpty()) { | 229 if (modifiers.isEmpty()) { |
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
624 { | 630 { |
625 m_completeResolver.clear(); | 631 m_completeResolver.clear(); |
626 m_showResolver.clear(); | 632 m_showResolver.clear(); |
627 m_abortResolver.clear(); | 633 m_abortResolver.clear(); |
628 if (m_clientBinding.is_bound()) | 634 if (m_clientBinding.is_bound()) |
629 m_clientBinding.Close(); | 635 m_clientBinding.Close(); |
630 m_paymentProvider.reset(); | 636 m_paymentProvider.reset(); |
631 } | 637 } |
632 | 638 |
633 } // namespace blink | 639 } // namespace blink |
OLD | NEW |