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..645fe2413edd443bf29e7954b2cb2369898594e0 100644 |
--- a/third_party/WebKit/Source/modules/payments/PaymentsValidators.cpp |
+++ b/third_party/WebKit/Source/modules/payments/PaymentsValidators.cpp |
@@ -14,7 +14,31 @@ static const int maxiumStringLength = 2048; |
bool PaymentsValidators::isValidCurrencyCodeFormat( |
const String& code, |
+ const String& system, |
String* optionalErrorMessage) { |
+ KURL currencySystemUrl = KURL(KURL(), system); |
+ if (!currencySystemUrl.isValid()) { |
please use gerrit instead
2016/10/12 23:35:50
Inline "currencySystemUrl":
if (!KURL(KURL(), sys
pals
2016/10/13 09:30:38
Done.
|
+ if (optionalErrorMessage) { |
please use gerrit instead
2016/10/12 23:35:49
Let's use {} in the same way as the rest of the fi
pals
2016/10/13 09:30:38
Done.
|
+ *optionalErrorMessage = "The currency system is not a valid url"; |
+ } |
+ |
+ return false; |
+ } |
+ |
+ if (system == "urn:iso:std:iso:4217") { |
please use gerrit instead
2016/10/12 23:35:50
This is a URN, which is different from URL. Theref
pals
2016/10/13 09:30:38
Done.
|
+ if (ScriptRegexp("^[A-Z]{3}$", TextCaseSensitive).match(code) == 0) |
+ return true; |
+ |
+ if (optionalErrorMessage) { |
please use gerrit instead
2016/10/12 23:35:50
No need for {}
pals
2016/10/13 09:30:38
Done.
|
+ *optionalErrorMessage = |
+ "'" + code + |
+ "' is not a valid ISO 4217 " |
+ "currency code, should be 3 upper case letters [A-Z]"; |
+ } |
+ |
+ return false; |
+ } |
+ |
if (code.length() <= maxiumStringLength) |
return true; |