Changeset 202341 in webkit
- Timestamp:
- Jun 22, 2016 11:43:18 AM (8 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r202339 r202341 1 2016-06-22 Anders Carlsson <andersca@apple.com> 2 3 Exception is not thrown when shipping method is an invalid amount 4 https://bugs.webkit.org/show_bug.cgi?id=159029 5 rdar://problem/26700413 6 7 Reviewed by Tim Horton. 8 9 * Modules/applepay/PaymentRequest.h: 10 Change ShippingMethod::amount to be a signed 64-bit integer. 11 12 * Modules/applepay/PaymentRequestValidator.cpp: 13 (WebCore::PaymentRequestValidator::validate): 14 Call validateShippingMethods. 15 16 (WebCore::PaymentRequestValidator::validateShippingMethods): 17 Validate all the shipping methods. 18 19 (WebCore::PaymentRequestValidator::validateShippingMethod): 20 Check that the amount is >= 0. 21 22 * Modules/applepay/PaymentRequestValidator.h: 23 Add new members. 24 1 25 2016-06-22 Adam Bergkvist <adam.bergkvist@ericsson.com> 2 26 -
trunk/Source/WebCore/Modules/applepay/PaymentRequest.h
r202298 r202341 113 113 String label; 114 114 String detail; 115 uint64_t amount;115 int64_t amount; 116 116 117 117 String identifier; -
trunk/Source/WebCore/Modules/applepay/PaymentRequestValidator.cpp
r202309 r202341 58 58 if (!validateTotal(paymentRequest.total())) 59 59 return false; 60 60 if (!validateShippingMethods(paymentRequest.shippingMethods())) 61 return false; 61 62 return true; 62 63 } … … 137 138 } 138 139 140 bool PaymentRequestValidator::validateShippingMethod(const PaymentRequest::ShippingMethod& shippingMethod) const 141 { 142 if (shippingMethod.amount < 0) { 143 m_window.printErrorMessage("Shipping method amount must be greater than or equal to zero."); 144 return false; 145 } 146 147 return true; 148 } 149 139 150 bool PaymentRequestValidator::validateSupportedNetworks(const PaymentRequest::SupportedNetworks& supportedNetworks) const 140 151 { … … 147 158 } 148 159 160 bool PaymentRequestValidator::validateShippingMethods(const Vector<PaymentRequest::ShippingMethod>& shippingMethods) const 161 { 162 for (const auto& shippingMethod : shippingMethods) { 163 if (!validateShippingMethod(shippingMethod)) 164 return false; 165 } 166 167 return true; 168 } 169 149 170 } 150 171 -
trunk/Source/WebCore/Modules/applepay/PaymentRequestValidator.h
r202309 r202341 48 48 bool validateSupportedNetworks(const PaymentRequest::SupportedNetworks&) const; 49 49 50 bool validateShippingMethods(const Vector<PaymentRequest::ShippingMethod>&) const; 51 bool validateShippingMethod(const PaymentRequest::ShippingMethod&) const; 52 50 53 DOMWindow& m_window; 51 54 };
Note: See TracChangeset
for help on using the changeset viewer.