Index: third_party/WebKit/Source/modules/payments/PaymentsValidators.cpp |
diff --git a/third_party/WebKit/Source/modules/payments/PaymentsValidators.cpp b/third_party/WebKit/Source/modules/payments/PaymentsValidators.cpp |
index 5fe6dd2cd91e9b298c9c2da680fdb89e1cdb10fb..8d664b5a3c918cd89a341ef884f1330577ab34b1 100644 |
--- a/third_party/WebKit/Source/modules/payments/PaymentsValidators.cpp |
+++ b/third_party/WebKit/Source/modules/payments/PaymentsValidators.cpp |
@@ -9,12 +9,12 @@ |
namespace blink { |
-// We limit the maximum length of the currency code to 2048 bytes for security reasons. |
-static const int maxCurrencyCodeLength = 2048; |
+// We limit the maximum length of string to 2048 bytes for security reasons. |
+static const int maxiumStringLength = 2048; |
bool PaymentsValidators::isValidCurrencyCodeFormat(const String& code, String* optionalErrorMessage) |
{ |
- if (code.length() <= maxCurrencyCodeLength) |
+ if (code.length() <= maxiumStringLength) |
return true; |
if (optionalErrorMessage) |
@@ -88,4 +88,15 @@ bool PaymentsValidators::isValidShippingAddress(const mojom::blink::PaymentAddre |
return true; |
} |
+bool PaymentsValidators::isValidErrorMsgFormat(const String& error, String* optionalErrorMessage) |
+{ |
+ if (error.length() <= maxiumStringLength) |
+ return true; |
+ |
+ if (optionalErrorMessage) |
+ *optionalErrorMessage = "Error message should be at most 2048 characters long"; |
+ |
+ return false; |
+} |
+ |
} // namespace blink |