Commit 3184e875 authored by Mohamad Ahmadi's avatar Mohamad Ahmadi Committed by Commit Bot

[PR] Fixes a bug with the currency amount validation

This CL fixes a bug where the value of the currency amount was being
checked against the maximum allowed string length not the length of the
value string.

Bug: 806666
Cq-Include-Trybots: master.tryserver.chromium.mac:ios-simulator-cronet;master.tryserver.chromium.mac:ios-simulator-full-configs
Change-Id: I8897c93f06e8cb590c5414497b53ab87fa291e77
Reviewed-on: https://chromium-review.googlesource.com/895546Reviewed-by: default avatarRouslan Solomakhin <rouslan@chromium.org>
Commit-Queue: Moe Ahmadi <mahmadi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#533317}
parent f2a1946d
...@@ -182,7 +182,8 @@ var SerializedPaymentResponse; ...@@ -182,7 +182,8 @@ var SerializedPaymentResponse;
amount, amountName) { amount, amountName) {
// Convert the value to String if it isn't already one. // Convert the value to String if it isn't already one.
amount.value = String(amount.value); amount.value = String(amount.value);
if (amount.value > __gCrWeb['paymentRequestManager'].MAX_STRING_LENGTH) { if (amount.value.length >
__gCrWeb['paymentRequestManager'].MAX_STRING_LENGTH) {
throw new TypeError( throw new TypeError(
amountName + ' value cannot be longer than ' + amountName + ' value cannot be longer than ' +
__gCrWeb['paymentRequestManager'].MAX_STRING_LENGTH + ' characters'); __gCrWeb['paymentRequestManager'].MAX_STRING_LENGTH + ' characters');
......
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