[Web Payment] Verbose message when failed to download manifest.
Before this patch, a failure to download a payment manifest would be
printed in developer console, but would not be returned back to the
merchant. This made debugging production problems difficult, because
real world users have different configurations that can be hard to
predict and replicate in a local development environment.
This patch forwards the errors from the downloader to the merchant when
rejecting the promise returned from PaymentRequest.show(). If multiple
errors occur, only the first one is forwarded. If PaymentRequest.show()
is not being rejected, then the downloader error is still printed in the
developer console, but not forwarded to the merchant.
After this patch, the first failure to download a payment manifest is
forwarded to the merchant in the rejection of the promise returned
from PaymentRequest.show().
Bug: 977145
Change-Id: Ide9021293099a9c1488ac3d1bd2c96ce9afe2e46
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1685429
Commit-Queue: Rouslan Solomakhin <[email protected]>
Reviewed-by: Sahel Sharify <[email protected]>
Reviewed-by: Moe Ahmadi <[email protected]>
Cr-Commit-Position: refs/heads/master@{#676602}
diff --git a/components/payments/content/payment_request.cc b/components/payments/content/payment_request.cc
index 1771e48..40ee346 100644
--- a/components/payments/content/payment_request.cc
+++ b/components/payments/content/payment_request.cc
@@ -240,7 +240,7 @@
if (!state_) {
// SSL is not valid. Reject show with NotSupportedError, disconnect the
// mojo pipe, and destroy this object.
- AreRequestedMethodsSupportedCallback(false);
+ AreRequestedMethodsSupportedCallback(false, reject_show_error_message_);
return;
}
@@ -480,7 +480,8 @@
}
void PaymentRequest::AreRequestedMethodsSupportedCallback(
- bool methods_supported) {
+ bool methods_supported,
+ const std::string& error_message) {
if (methods_supported) {
if (SatisfiesSkipUIConstraints())
Pay();
@@ -490,9 +491,8 @@
journey_logger_.SetNotShown(
JourneyLogger::NOT_SHOWN_REASON_NO_SUPPORTED_PAYMENT_METHOD);
client_->OnError(mojom::PaymentErrorReason::NOT_SUPPORTED,
- !reject_show_error_message_.empty()
- ? reject_show_error_message_
- : GetNotSupportedErrorMessage(spec_.get()));
+ GetNotSupportedErrorMessage(spec_.get()) +
+ (error_message.empty() ? "" : " " + error_message));
if (observer_for_testing_)
observer_for_testing_->OnNotSupportedError();
OnConnectionTerminated();