Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1022)

Unified Diff: third_party/WebKit/Source/modules/payments/PaymentsValidators.cpp

Issue 2851383002: Verify behavior of PaymentRequest constructor. (Closed)
Patch Set: Comments Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 989d5ecf46aec4f4c056917ecf996c0341ec69c0..7aac315f4073cf590d37020b4f11735608bc042f 100644
--- a/third_party/WebKit/Source/modules/payments/PaymentsValidators.cpp
+++ b/third_party/WebKit/Source/modules/payments/PaymentsValidators.cpp
@@ -48,13 +48,16 @@ bool PaymentsValidators::IsValidCurrencyCodeFormat(
}
bool PaymentsValidators::IsValidAmountFormat(const String& amount,
+ const String& item_name,
String* optional_error_message) {
if (ScriptRegexp("^-?[0-9]+(\\.[0-9]+)?$", kTextCaseSensitive)
.Match(amount) == 0)
return true;
- if (optional_error_message)
- *optional_error_message = "'" + amount + "' is not a valid amount format";
+ if (optional_error_message) {
+ *optional_error_message =
+ "'" + amount + "' is not a valid amount format for " + item_name;
+ }
return false;
}

Powered by Google App Engine
This is Rietveld 408576698