Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add redactList for PaymentAddress (Part 1) #654

Merged
merged 35 commits into from
Mar 15, 2018

Conversation

marcoscaceres
Copy link
Member

@marcoscaceres marcoscaceres commented Nov 20, 2017

closes #648 #643 #676 #692

The following tasks have been completed:

Implementation commitment:

  • Safari (implemented in ApplePay - redacts)
  • Chrome - planning.
  • Firefox - redacts.
  • Edge - keeping current behavior (no redact)

Preview | Diff

@marcoscaceres
Copy link
Member Author

@domenic, @rsolomakhin, all, please note that this is incomplete, just seeking feedback on approach at this point (you will spot a "To Be Written" algo).

I need to read E.164 spec in details, so to understand a bit more about phone number formats and structure. In any case, let me know what you think!

Renaming PaymentAddress might be "nice" too... but maybe too late, unless we go down the NamedConstructor route 🙀, which I don't think we want.. or we can just live with the crappy name.

index.html Outdated
</section>
<section>
<h2>
Creating a <code>PaymentAddress</code>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pardon my noob question. Why do we need both "constructor" and "creating" sections?

Copy link
Member Author

@marcoscaceres marcoscaceres Nov 21, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, we might need to merge them... one is supposed to impose order when constructing from user input (should rename this section more clearly), while the other is for calling the constructor from script.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

*constructing

Copy link
Member Author

@marcoscaceres marcoscaceres Dec 1, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm going to change this algo to use an AddressInit dictionary instead. The algorithm will also take an optional "excludeList", which will exclude dictionary members as per #648. That should solve for onpaymentaddresschange privacy issues.

Copy link
Collaborator

@rsolomakhin rsolomakhin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looks good!

Copy link
Collaborator

@domenic domenic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Found some nits!

index.html Outdated
address for display.
</dd>
<dt>
<dfn>organization</dfn>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The capitalization is inconsistent on these components of an address. I think consistently lowercase would be best.

index.html Outdated
</h2>
<pre class="idl">
[SecureContext, Exposed=(Window,Worker), Constructor(optional AddressInit details)]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does exposing this in workers make sense?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we want MAY want expose it for Payment Hander. I can redact it until we are 100% on the API.

index.html Outdated
[SecureContext, Exposed=(Window,Worker), Constructor(optional AddressInit details)]
interface PaymentAddress {
[Default] object toJSON();
readonly attribute DOMString country;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The order here doesn't match the above, which is pretty confusing.

index.html Outdated
</h2>
<p>
The steps to <dfn data-lt="PaymentAddress.PaymentAddress()"
data-no-default="">construct a <code>PymentAddress</code></dfn>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo "PymentAddress"

index.html Outdated
<code><a data-cite=
"!WEBIDL#idl-sequence">sequence</a>&lt;<a data-cite=
"WEBIDL#idl-DOMString">DOMString</a>&gt;</code>, and all other
internal slots set to the empty string.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you want to distinguish between null and empty string? Null feels a bit more natural for "unset" fields.

I have a feeling we discussed this before... apologies if so.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We indeed have... I wanted null too :) But then I started playing around with integrating with <form> and the empty string turned out to be a better fit.

index.html Outdated
<ol>
<li>Check if <var>details</var>["<a>phone</a>"] is a
<a>structurally valid phone number</a>, throw a
<a>RangeError</a>.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Presumably only throw the RangeError if it is not a structurally valid phone number. As phrased, this always throws it.

index.html Outdated
<a>RangeError</a>.
</li>
<li>Set <var>address</var>.<a>[[\phone]]</a> to the result of
<a>canonicalize a phone number</a>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

canonicalizing the phone number

index.html Outdated
</td>
<td>
A <a>country</a> as an [[!ISO3166]] alpha-2 code or the empty
string. The canonical form is upper case. For example, "JP".
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would phrase this as "stored in its canonical uppercase form"

index.html Outdated
<li>If <var>tel</var> contains U+000A LINE FEED (LF) or U+000D
CARRIAGE RETURN (CR) characters, return false.
</li>
<li>Strip and collapse ASCII whitespace in <var>tel</var>.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

index.html Outdated
</li>
<li>Strip and collapse ASCII whitespace in <var>tel</var>.
</li>
<li>If the length is greater 15, return false.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If tel's length is greater than 15...

@marcoscaceres
Copy link
Member Author

Commit I just pushed is still WIP... not ready for review.

@marcoscaceres marcoscaceres changed the title WIP: add constructor to PaymentAddress Feat: add constructor to PaymentAddress Dec 8, 2017
@marcoscaceres marcoscaceres mentioned this pull request Dec 8, 2017
4 tasks
@domenic
Copy link
Collaborator

domenic commented Jan 19, 2018

@marcoscaceres would you like re-review of this?

@marcoscaceres
Copy link
Member Author

Not yet. I will try to finish it this week. It’s still missing some stuff around phone numbers.

The [[!INFRA] specification defines how to <dfn data-cite=
"!INFRA#strip-leading-and-trailing-ascii-whitespace">strip leading
and trailing ascii whitespace</dfn>. It also defines the concpet of a
<dfn data-cite="!INFRA#list">list</dfn>.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the input form allows a wider range of UTF-8 encoded Unicode characters (not just the ASCII range), then stripping only ASCII whitespace will not necessarily yield the hoped-for result here because a fair number of Unicode code points have a Unicode general category of "Zs". For example, U+1680 (OGHAM SPACE MARK) would not get stripped unless non-ASCII space gets converted to ASCII space.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, that's a good point... specially because this might be coming from free form input from a end-user (e.g., "region").

@domenic, seems JS String.prototpye.trim() does mostly the right thing (some bugginess across browsers). Do you have any suggestions?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here is a test string:

var whiteSpace = 
"\u0009\u000A\u000B\u000C\u000D\u0020\u0085\u00A0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u2028\u2029\u202F\u205F\u3000"
whiteSpace.trim().length; // 1, because u0085 is apparently not WS. 

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We never trim Unicode whitespace on the platform. Only ASCII whitespace is considered as "allowed sloppiness" in argument values.

An alternative is to not remove such whitespace at all.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@domenic Hmm. Do we assume that non-ASCII Unicode code points with a General Category of "Zs" will be filtered out somehow? (For example, by conversion of such code points to SPACE [U+0020]?) If this is guidance that the i18n WG has provided in the past, perhaps I've just missed the pointer. I can ask in the next i18n WG call if needed.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally if a string contains Unicode whitespace, we don't try to second-guess the user or developer, and just pass it through.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the clarification! I just asked about it on the www-international list, too: https://lists.w3.org/Archives/Public/www-international/2018JanMar/0042.html

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm ok with doing the minimal ASCII whitespace stripping, for platform consistency. Developers can then call .trim() to strip out the rest if so desired.

@marcoscaceres
Copy link
Member Author

So, from here, we will only take the optional privacy preserving list.

@marcoscaceres marcoscaceres force-pushed the paymentaddress_constructor branch 3 times, most recently from eb380dd to 6d74799 Compare February 27, 2018 05:36
@marcoscaceres marcoscaceres changed the title Feat: add constructor to PaymentAddress Feat: add regionCode and exclusionList to PaymentAddress Feb 27, 2018
@marcoscaceres
Copy link
Member Author

@domenic, this is ready to review again.

Based on discussions with Editors, this PR primarily:

@marcoscaceres
Copy link
Member Author

Noting for those following at home: excludeList is optional as Chrome and Edge wish to preserve their current behavior. Firefox will make use of the excludeList and behave similarly to Safari. We might tweak the excludeList values if we find it's overly restrictive.

@rsolomakhin
Copy link
Collaborator

Following at home

@marcoscaceres
Copy link
Member Author

Added tests web-platform-tests/wpt#9706

@marcoscaceres
Copy link
Member Author

Added implementation commitment from Firefox.

@marcoscaceres
Copy link
Member Author

Actually, I want to land this in two parts.

  1. The editorial rewrite of Physical Addresses.
  2. Then the region code.

That way, 1 can land now... and then 2 can land when we get another implementer to commit.

@marcoscaceres marcoscaceres changed the title Feat: add regionCode and exclusionList to PaymentAddress Feat: add exclusionList for PaymentAddress Feb 28, 2018
@marcoscaceres
Copy link
Member Author

With just the excludeList, this matches WebKit and Firefox - and let's Chrome and Edge keep returning full address information for the onpaymentaddresschange event.

@marcoscaceres
Copy link
Member Author

Thanks @rsolomakhin for also having a look! Oki, should hopefully be all good now 🤞

@marcoscaceres
Copy link
Member Author

Thanks again @domenic!!! (the above is @rsolomakhin's fault, he started the whole gifs thing 😁)

@rsolomakhin
Copy link
Collaborator

Well done, sir.

gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified-and-comments-removed that referenced this pull request Oct 2, 2019
… promise from PaymentRequest.show() resolves successfully. r=baku

Spec PR: w3c/payment-request#654

MozReview-Commit-ID: 2AiKI7htRhk

UltraBlame original commit: 8a29a154e88dc58d0ffde543a2159d70638ce53c
gecko-dev-updater pushed a commit to marco-c/gecko-dev-comments-removed that referenced this pull request Oct 2, 2019
… promise from PaymentRequest.show() resolves successfully. r=baku

Spec PR: w3c/payment-request#654

MozReview-Commit-ID: 2AiKI7htRhk

UltraBlame original commit: 8a29a154e88dc58d0ffde543a2159d70638ce53c
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified-and-comments-removed that referenced this pull request Oct 2, 2019
… promise from PaymentRequest.show() resolves successfully. r=baku

Spec PR: w3c/payment-request#654

MozReview-Commit-ID: 2AiKI7htRhk

UltraBlame original commit: fbc6dec319be8067e0d26055e9c93a5fca74d718
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified that referenced this pull request Oct 2, 2019
… promise from PaymentRequest.show() resolves successfully. r=baku

Spec PR: w3c/payment-request#654

MozReview-Commit-ID: 2AiKI7htRhk

UltraBlame original commit: 8a29a154e88dc58d0ffde543a2159d70638ce53c
gecko-dev-updater pushed a commit to marco-c/gecko-dev-comments-removed that referenced this pull request Oct 2, 2019
… promise from PaymentRequest.show() resolves successfully. r=baku

Spec PR: w3c/payment-request#654

MozReview-Commit-ID: 2AiKI7htRhk

UltraBlame original commit: fbc6dec319be8067e0d26055e9c93a5fca74d718
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified that referenced this pull request Oct 2, 2019
… promise from PaymentRequest.show() resolves successfully. r=baku

Spec PR: w3c/payment-request#654

MozReview-Commit-ID: 2AiKI7htRhk

UltraBlame original commit: fbc6dec319be8067e0d26055e9c93a5fca74d718
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

redact full shipping address from event until payment response
4 participants