Chromium Code Reviews| 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..68aa92f27ca25e9baf25971f731fb50741bde528 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"; |
|
please use gerrit instead
2016/10/13 17:37:54
Upper-case "URL" please.
pals
2016/10/14 14:41:21
Done.
|
| + |
| + return false; |
| + } |
| + |
| if (code.length() <= maxiumStringLength) |
| return true; |