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

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

Issue 2836443002: No rate limit for canMakePayment() on localhost and file://. (Closed)
Patch Set: Comments Created 3 years, 8 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
« no previous file with comments | « components/payments/mojom/payment_request.mojom ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/modules/payments/PaymentRequest.cpp
diff --git a/third_party/WebKit/Source/modules/payments/PaymentRequest.cpp b/third_party/WebKit/Source/modules/payments/PaymentRequest.cpp
index 980e474a04195ec2cd3f7fe7d026515af1d7d13a..6283adc3f709a6c6d072ed626691c1c49a77e20a 100644
--- a/third_party/WebKit/Source/modules/payments/PaymentRequest.cpp
+++ b/third_party/WebKit/Source/modules/payments/PaymentRequest.cpp
@@ -671,6 +671,15 @@ bool AllowedToUsePaymentRequest(const Frame* frame) {
return false;
}
+void WarnIgnoringQueryQuotaForCanMakePayment(
+ ExecutionContext& execution_context) {
+ execution_context.AddConsoleMessage(ConsoleMessage::Create(
+ kJSMessageSource, kWarningMessageLevel,
+ "Quota reached for PaymentRequest.canMakePayment(). This would normally "
+ "reject the promise, but allowing continued usage on localhost and "
+ "file:// scheme origins."));
+}
+
} // namespace
PaymentRequest* PaymentRequest::Create(
@@ -1066,9 +1075,15 @@ void PaymentRequest::OnCanMakePayment(CanMakePaymentQueryResult result) {
DCHECK(can_make_payment_resolver_);
switch (result) {
+ case CanMakePaymentQueryResult::WARNING_CAN_MAKE_PAYMENT:
+ WarnIgnoringQueryQuotaForCanMakePayment(*GetExecutionContext());
+ // Intentionally fall through.
case CanMakePaymentQueryResult::CAN_MAKE_PAYMENT:
can_make_payment_resolver_->Resolve(true);
break;
+ case CanMakePaymentQueryResult::WARNING_CANNOT_MAKE_PAYMENT:
+ WarnIgnoringQueryQuotaForCanMakePayment(*GetExecutionContext());
+ // Intentionally fall through.
case CanMakePaymentQueryResult::CANNOT_MAKE_PAYMENT:
can_make_payment_resolver_->Resolve(false);
break;
« no previous file with comments | « components/payments/mojom/payment_request.mojom ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698