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

Issue 2851383002: Verify behavior of PaymentRequest constructor. (Closed)

Created:
3 years, 7 months ago by please use gerrit instead
Modified:
3 years, 7 months ago
CC:
blink-reviews, blink-reviews-w3ctests_chromium.org, chromium-reviews, darin-cc_chromium.org, gogerald+paymentswatch_chromium.org, jam, mahmadi+paymentswatch_chromium.org, rouslan+payments_chromium.org, sebsg+paymentswatch_chromium.org
Target Ref:
refs/heads/master
Project:
chromium
Visibility:
Public.

Description

Verify behavior of PaymentRequest constructor. This patch adds web platform tests that verify behavior of PaymentRequest constructor. To match the spec, PaymentRequest constructor in this patch has been changed to: - Check for secure context before validating any parameters. - Check the amount value first before checking the rest of the fields in each line item. - Determine the selected shipping option even if requestShipping is false. - Validate shipping options even if requestShipping is false. - Validate shipping options before checking for duplicate shipping option IDs. - Allow empty line item labels (but discourage via a console warning). - Allow empty shipping option ID (but discourage via a console warning). - Allow empty list of modifiers. Because of changes in the WebIDL, certain conditions are not possible, so they are ensured via DCHECK() in this patch instead of if statements before this patch: - Total is always present. - Every line item has a label and amount. - Every amount has value and currency. - Every shipping option has an ID. - Shipping type is always valid. Invalid shipping type ("delivery", "shipping", or "pickup") is now impossible because the WebIDL specifies it as an enum. Therefore, there's no need for additional validation there. To help developers better decipher the behavior of the API, error messages have been improved in this patch. For example: "'-1/3' is not a valid amount for total." Spec: https://w3c.github.io/browser-payment-api/#constructor BUG=705252 Review-Url: https://codereview.chromium.org/2851383002 Cr-Commit-Position: refs/heads/master@{#469369} Committed: https://chromium.googlesource.com/chromium/src/+/dca98e1e37e61a0019ab182bdd7b18748575b6f1

Patch Set 1 #

Total comments: 8

Patch Set 2 : Comments #

Total comments: 6

Patch Set 3 : Comments #

Messages

Total messages: 36 (26 generated)
please use gerrit instead
Marijn, ptal. Am I taking the right approach here? I looked at one section of ...
3 years, 7 months ago (2017-05-03 14:15:03 UTC) #15
Marijn Kruisselbrink
the approach looks reasonable to me. I wonder if some of the tests would be ...
3 years, 7 months ago (2017-05-03 18:26:51 UTC) #16
please use gerrit instead
Ptal patch 2. https://codereview.chromium.org/2851383002/diff/20001/third_party/WebKit/LayoutTests/external/wpt/payment-request/payment-request-constructor.https.html File third_party/WebKit/LayoutTests/external/wpt/payment-request/payment-request-constructor.https.html (right): https://codereview.chromium.org/2851383002/diff/20001/third_party/WebKit/LayoutTests/external/wpt/payment-request/payment-request-constructor.https.html#newcode5 third_party/WebKit/LayoutTests/external/wpt/payment-request/payment-request-constructor.https.html:5: <script src="../resources/testharness.js"></script> On 2017/05/03 18:26:51, Marijn ...
3 years, 7 months ago (2017-05-03 19:30:24 UTC) #19
Marijn Kruisselbrink
lgtm https://codereview.chromium.org/2851383002/diff/40001/third_party/WebKit/Source/modules/payments/PaymentRequest.cpp File third_party/WebKit/Source/modules/payments/PaymentRequest.cpp (right): https://codereview.chromium.org/2851383002/diff/40001/third_party/WebKit/Source/modules/payments/PaymentRequest.cpp#newcode156 third_party/WebKit/Source/modules/payments/PaymentRequest.cpp:156: ConsoleMessage::Create(kJSMessageSource, kErrorMessageLevel, nit: would it make sense for ...
3 years, 7 months ago (2017-05-03 23:11:00 UTC) #22
haraken
Just a drive-by :) https://codereview.chromium.org/2851383002/diff/40001/third_party/WebKit/Source/modules/payments/PaymentRequest.cpp File third_party/WebKit/Source/modules/payments/PaymentRequest.cpp (right): https://codereview.chromium.org/2851383002/diff/40001/third_party/WebKit/Source/modules/payments/PaymentRequest.cpp#newcode411 third_party/WebKit/Source/modules/payments/PaymentRequest.cpp:411: if (!input.V8Value()->IsObject() || input.V8Value()->IsArray() || ...
3 years, 7 months ago (2017-05-04 09:47:52 UTC) #24
please use gerrit instead
https://codereview.chromium.org/2851383002/diff/40001/third_party/WebKit/Source/modules/payments/PaymentRequest.cpp File third_party/WebKit/Source/modules/payments/PaymentRequest.cpp (right): https://codereview.chromium.org/2851383002/diff/40001/third_party/WebKit/Source/modules/payments/PaymentRequest.cpp#newcode156 third_party/WebKit/Source/modules/payments/PaymentRequest.cpp:156: ConsoleMessage::Create(kJSMessageSource, kErrorMessageLevel, On 2017/05/03 23:10:59, Marijn Kruisselbrink wrote: > ...
3 years, 7 months ago (2017-05-04 15:17:15 UTC) #27
please use gerrit instead
On 2017/05/04 15:17:15, ಠ_ಠ wrote: > Good point, the spec does prohibit arrays. Added a ...
3 years, 7 months ago (2017-05-04 15:17:42 UTC) #28
haraken
LGTM
3 years, 7 months ago (2017-05-04 15:24:35 UTC) #29
commit-bot: I haz the power
CQ is trying da patch. Follow status at: https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2851383002/60001
3 years, 7 months ago (2017-05-04 16:15:11 UTC) #33
commit-bot: I haz the power
3 years, 7 months ago (2017-05-04 17:18:00 UTC) #36
Message was sent while issue was closed.
Committed patchset #3 (id:60001) as
https://chromium.googlesource.com/chromium/src/+/dca98e1e37e61a0019ab182bdd7b...

Powered by Google App Engine
This is Rietveld 408576698