| 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 9a9a3d6b897f957a51a5e870a3d4bc7cf98833f9..d5cb3dc4ab0909423f587eb1d0fdaf996db3a4fa 100644
|
| --- a/third_party/WebKit/Source/modules/payments/PaymentsValidators.cpp
|
| +++ b/third_party/WebKit/Source/modules/payments/PaymentsValidators.cpp
|
| @@ -14,7 +14,27 @@ static const int maxiumStringLength = 2048;
|
|
|
| bool PaymentsValidators::isValidCurrencyCodeFormat(
|
| const String& code,
|
| + const String& system,
|
| String* optionalErrorMessage) {
|
| + if (system == "urn:iso:std:iso:4217") {
|
| + if (ScriptRegexp("^[A-Z]{3}$", TextCaseSensitive).match(code) == 0)
|
| + return true;
|
| +
|
| + if (optionalErrorMessage)
|
| + *optionalErrorMessage = "'" + code +
|
| + "' is not a valid ISO 4217 currency code, should "
|
| + "be 3 upper case letters [A-Z]";
|
| +
|
| + return false;
|
| + }
|
| +
|
| + if (!KURL(KURL(), system).isValid()) {
|
| + if (optionalErrorMessage)
|
| + *optionalErrorMessage = "The currency system is not a valid URL";
|
| +
|
| + return false;
|
| + }
|
| +
|
| if (code.length() <= maxiumStringLength)
|
| return true;
|
|
|
|
|