Chromium Code Reviews| Index: ios/chrome/browser/web/resources/payment_request.js |
| diff --git a/ios/chrome/browser/web/resources/payment_request.js b/ios/chrome/browser/web/resources/payment_request.js |
| index e31b81916c3154ac74c53dddcda39cbbadbf5963..6511e240bed511ce4a1ce49b407c1e2ea97fc50c 100644 |
| --- a/ios/chrome/browser/web/resources/payment_request.js |
| +++ b/ios/chrome/browser/web/resources/payment_request.js |
| @@ -230,20 +230,21 @@ var SerializedPaymentResponse; |
| /** |
| * Handles invocation of updateWith() on the updateEvent object. Updates the |
| - * payment details when the |updateWithPromise| is resolved. Throws an error |
| - * if |updateWithPromise| is not a valid instance of Promise or if it fulfills |
| - * with an invalid instance of window.PaymentDetails. |
| - * @param {?Promise<?window.PaymentDetails|undefined>|undefined} |
| - * updateWithPromise |
| - */ |
| - __gCrWeb['paymentRequestManager'].updateWith = function(updateWithPromise) { |
| - // Check to see |updateWithPromise| is an instance of Promise. |
| - if (!updateWithPromise || !(updateWithPromise.then instanceof Function) || |
| - !(updateWithPromise.catch instanceof Function)) { |
| - throw new TypeError('An instance of Promise must be provided'); |
| + * payment details. Throws an error if |detailsPromise| is not a valid |
| + * instance of window.PaymentDetails or it is a promise that does not fulfill |
| + * with a valid one. |
| + * @param {!Promise<!window.PaymentDetails>|!window.PaymentDetails} |
| + * detailsPromise |
| + */ |
| + __gCrWeb['paymentRequestManager'].updateWith = function(detailsPromise) { |
|
please use gerrit instead
2017/04/28 13:07:23
Nit: Please change this parameter name to "details
Moe
2017/04/28 13:40:43
Done.
|
| + // if |detailsPromise| is not an instance of a Promise, wrap it in a Promise |
| + // that fulfills with |detailsPromise|. |
| + if (!detailsPromise || !(detailsPromise.then instanceof Function) || |
| + !(detailsPromise.catch instanceof Function)) { |
| + detailsPromise = Promise.resolve(detailsPromise); |
| } |
| - updateWithPromise |
| + detailsPromise |
| .then(function(paymentDetails) { |
| if (!paymentDetails) |
| throw new TypeError( |