Commit f6347345 authored by Sahel Sharify's avatar Sahel Sharify Committed by Commit Bot

[Payments] secure-payment-confirmation should be the only method.

This cl throws a range error when extra payment methods are specified
along with "secure-payment-confirmation".

Change-Id: I68b321a123fb9df8d61f733f1c6e81f024e21d61
Bug: 1110320
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2340670Reviewed-by: default avatarRouslan Solomakhin <rouslan@chromium.org>
Commit-Queue: Sahel Sharify <sahel@chromium.org>
Cr-Commit-Position: refs/heads/master@{#797209}
parent 769f572f
......@@ -98,6 +98,7 @@ const char kAndroidPayMethod[] = "https://android.com/pay";
const char kGooglePlayBillingMethod[] = "https://play.google.com/billing";
const char kUnknownCurrency[] = "ZZZ";
const char kAppStoreBillingLabelPlaceHolder[] = "AppStoreBillingPlaceHolder";
const char kSecurePaymentConfirmationMethod[] = "secure-payment-confirmation";
} // namespace
......@@ -438,7 +439,7 @@ void StringifyAndParseMethodSpecificData(ExecutionContext& execution_context,
if (supported_method == "basic-card") {
BasicCardHelper::ParseBasiccardData(input, output->supported_networks,
exception_state);
} else if (supported_method == "secure-payment-confirmation" &&
} else if (supported_method == kSecurePaymentConfirmationMethod &&
RuntimeEnabledFeatures::SecurePaymentConfirmationEnabled(
&execution_context)) {
SecurePaymentConfirmationHelper::ParseSecurePaymentConfirmationData(
......@@ -676,6 +677,18 @@ void ValidateAndConvertPaymentMethodData(
return;
}
if (payment_method_data->supportedMethod() ==
kSecurePaymentConfirmationMethod &&
input.size() > 1 &&
RuntimeEnabledFeatures::SecurePaymentConfirmationEnabled(
&execution_context)) {
exception_state.ThrowRangeError(
String(kSecurePaymentConfirmationMethod) +
" must be the only payment method identifier specified in the "
"PaymentRequest constructor.");
return;
}
method_names.insert(payment_method_data->supportedMethod());
output.push_back(payments::mojom::blink::PaymentMethodData::New());
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment