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

Unified Diff: components/payments/content/payment_request.cc

Issue 2864013002: Verify behavior of PaymentRequest.show() method, part 1. (Closed)
Patch Set: step-func 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: components/payments/content/payment_request.cc
diff --git a/components/payments/content/payment_request.cc b/components/payments/content/payment_request.cc
index 68da7ff714a86963414c53c99fe4d04bb5fcbb54..3b6141bdc4d49740f042a6e6cc37fa6dc561bac4 100644
--- a/components/payments/content/payment_request.cc
+++ b/components/payments/content/payment_request.cc
@@ -99,6 +99,16 @@ void PaymentRequest::Show() {
return;
}
+ // A tab can display only one PaymentRequest UI at a time.
+ if (!manager_->CanShow(this)) {
+ LOG(ERROR) << "A PaymentRequest UI is already showing";
+ client_->OnError(mojom::PaymentErrorReason::USER_CANCEL);
+ client_.reset();
+ binding_.Close();
+ manager_->DestroyRequest(this);
+ return;
+ }
+
if (!state_->AreRequestedMethodsSupported()) {
client_->OnError(mojom::PaymentErrorReason::NOT_SUPPORTED);
if (observer_for_testing_)

Powered by Google App Engine
This is Rietveld 408576698