-
Notifications
You must be signed in to change notification settings - Fork 135
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
Conversation
@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 |
index.html
Outdated
</section> | ||
<section> | ||
<h2> | ||
Creating a <code>PaymentAddress</code> |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
*constructing
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall looks good!
There was a problem hiding this 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> |
There was a problem hiding this comment.
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)] |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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> |
There was a problem hiding this comment.
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><<a data-cite= | ||
"WEBIDL#idl-DOMString">DOMString</a>></code>, and all other | ||
internal slots set to the empty string. |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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>. |
There was a problem hiding this comment.
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> |
There was a problem hiding this comment.
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". |
There was a problem hiding this comment.
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>. |
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
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...
6b73009
to
610ab72
Compare
Commit I just pushed is still WIP... not ready for review. |
@marcoscaceres would you like re-review of this? |
Not yet. I will try to finish it this week. It’s still missing some stuff around phone numbers. |
400f759
to
ab1ba80
Compare
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>. |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
So, from here, we will only take the optional privacy preserving list. |
eb380dd
to
6d74799
Compare
@domenic, this is ready to review again. Based on discussions with Editors, this PR primarily:
|
Noting for those following at home: |
Added tests web-platform-tests/wpt#9706 |
Added implementation commitment from Firefox. |
Actually, I want to land this in two parts.
That way, 1 can land now... and then 2 can land when we get another implementer to commit. |
41ccdf0
to
82dd802
Compare
With just the |
f85627e
to
e21719c
Compare
Thanks @rsolomakhin for also having a look! Oki, should hopefully be all good now 🤞 |
Thanks again @domenic!!! (the above is @rsolomakhin's fault, he started the whole gifs thing 😁) |
… promise from PaymentRequest.show() resolves successfully. r=baku Spec PR: w3c/payment-request#654 MozReview-Commit-ID: 2AiKI7htRhk UltraBlame original commit: 8a29a154e88dc58d0ffde543a2159d70638ce53c
… promise from PaymentRequest.show() resolves successfully. r=baku Spec PR: w3c/payment-request#654 MozReview-Commit-ID: 2AiKI7htRhk UltraBlame original commit: 8a29a154e88dc58d0ffde543a2159d70638ce53c
… promise from PaymentRequest.show() resolves successfully. r=baku Spec PR: w3c/payment-request#654 MozReview-Commit-ID: 2AiKI7htRhk UltraBlame original commit: fbc6dec319be8067e0d26055e9c93a5fca74d718
… promise from PaymentRequest.show() resolves successfully. r=baku Spec PR: w3c/payment-request#654 MozReview-Commit-ID: 2AiKI7htRhk UltraBlame original commit: 8a29a154e88dc58d0ffde543a2159d70638ce53c
… promise from PaymentRequest.show() resolves successfully. r=baku Spec PR: w3c/payment-request#654 MozReview-Commit-ID: 2AiKI7htRhk UltraBlame original commit: fbc6dec319be8067e0d26055e9c93a5fca74d718
… promise from PaymentRequest.show() resolves successfully. r=baku Spec PR: w3c/payment-request#654 MozReview-Commit-ID: 2AiKI7htRhk UltraBlame original commit: fbc6dec319be8067e0d26055e9c93a5fca74d718
closes #648 #643 #676 #692
The following tasks have been completed:
Implementation commitment:
Preview | Diff