New issue
Advanced search Search tips

Issue 754587 link

Starred by 1 user

Issue metadata

Status: Verified
Owner:
Closed: Aug 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux , Windows , Chrome , Mac
Pri: 3
Type: Bug



Sign in to add a comment

Mixing Japanese and Latin characters in shipping address causes an exception in Payment Request desktop

Project Member Reported by agektmr@chromium.org, Aug 11 2017

Issue description

Chrome Version: Version 62.0.3180.0 (Official Build) canary (64-bit)
OS: Mac OS X

What steps will reproduce the problem?
(1) Go to https://polykart-credential-payment.appspot.com/
(2) Buy something and launch Payment Request sheet
(3) Choose an address that includes both Japanese chars and Latin chars

What is the expected result?
The address being selected.

What happens instead?
Payment Request abort with following exception:
Error while handling PaymentRequest.show(): SyntaxError: 'ja-Latn' is not a valid BCP-47 language code, should be 2-3 lower case letters [a-z]

Please use labels and text to provide additional information.


For graphics-related bugs, please copy/paste the contents of the about:gpu
page at the end of this report.

 

Comment 1 by sdy@chromium.org, Aug 14 2017

Components: Blink>Payments
Labels: OS-Chrome OS-Linux OS-Windows
Owner: rouslan@chromium.org
Status: Assigned (was: Untriaged)
Looks like desktop is not splitting the language tag into language code and script code. I'll fix.
Status: Started (was: Assigned)
Project Member

Comment 5 by bugdroid1@chromium.org, Aug 16 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/29bce136d5f3a695b27b5bf03edb77b756576997

commit 29bce136d5f3a695b27b5bf03edb77b756576997
Author: Rouslan Solomakhin <rouslan@chromium.org>
Date: Wed Aug 16 17:49:09 2017

[Payments] Split BCP-47 tag into language and script code.

Before this patch, using an autofill profile with "ja-Latn" language tag
on desktop would result in PaymentRequest.show() promise rejecting with
"SyntaxError: 'ja-Latn' is not a valid BCP-47 language code, should be
2-3 lower case letters [a-z]."

This was happening because the BCP-47 language tag (e.g., "ja-Latn")
from AutofillProfile was being written into the language code (e.g.,
"ja") of PaymentAddress. The IPC validation logic in Blink recognized
that "ja-Latn" is not a language code and aborted payment.

This patch splits the AutofillProfile language tag (e.g., "ja-Latn")
into its parts: language code (e.g., "ja") and script code (e.g.,
"Latn"). These parts are then saved in PaymentAddress.language_code and
PaymentAddress.script_code.

After this patch, using an autofill profile with "ja-Latn" language tag
on desktop will resolve the PaymentRequest.show() promise with the
language tag correctly set in the shipping address returned to the
webpage.

Bug:  754587 
Change-Id: If34bd0962f58de95d05fe780391683c0ce1ee878
Reviewed-on: https://chromium-review.googlesource.com/616200
Reviewed-by: Anthony Vallee-Dubois <anthonyvd@chromium.org>
Commit-Queue: Rouslan Solomakhin <rouslan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#494848}
[modify] https://crrev.com/29bce136d5f3a695b27b5bf03edb77b756576997/components/payments/content/payment_details_validation.cc
[modify] https://crrev.com/29bce136d5f3a695b27b5bf03edb77b756576997/components/payments/content/payment_request_state_unittest.cc
[modify] https://crrev.com/29bce136d5f3a695b27b5bf03edb77b756576997/components/payments/content/payment_response_helper.cc
[modify] https://crrev.com/29bce136d5f3a695b27b5bf03edb77b756576997/components/payments/content/payments_validators.cc
[modify] https://crrev.com/29bce136d5f3a695b27b5bf03edb77b756576997/components/payments/content/payments_validators.h
[modify] https://crrev.com/29bce136d5f3a695b27b5bf03edb77b756576997/components/payments/content/payments_validators_unittest.cc

agektmr@ -- please verify in the next canary build.

Leaving this open, because we may want to merge to M-62.
^H^H^H M-61
Status: Verified (was: Started)
Verified it works. Thanks for the hard work!

Sign in to add a comment