-
Notifications
You must be signed in to change notification settings - Fork 42
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 AbortPaymentEvent. #207
Conversation
Pease don't merge until I've reported on implementation experience. |
Spec change: w3c/payment-handler#207 Bug: 736745 Change-Id: Ifb78aa332080044180e2e836ac0709ba3f727567 Reviewed-on: https://chromium-review.googlesource.com/636504 Reviewed-by: Rouslan Solomakhin <[email protected]> Commit-Queue: Ganggui Tang <[email protected]> Cr-Commit-Position: refs/heads/master@{#498114}
Made a "do not merge" label... to celebrate :) |
If CanMakePayment event is risky, AbortPayment event might also be risky? |
The user agent fires the |
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.
This is a good start. I think we can get Payment Request to do some of the work tho.
</pre> | ||
</pre> | ||
<p> | ||
The <a>paymentManager</a> attribute exposes payment handler |
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.
Shouldn't this be a 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.
There's a for paymentManager eight lines above. I'm not super familiar with spec format, but shouldn't there be a single tag per term in a spec?
<h2> | ||
Aborting an invocation | ||
</h2> | ||
<p> |
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.
This paragraph is redundant. This should be in an algorithm somewhere (probably is, just haven't gotten to it).
the <a>user agent</a> fires <a>AbortPaymentEvent</a> in the <a>payment | ||
handler</a> that is currently handling <a>PaymentRequestEvent</a>. | ||
There is no expectation that the <a>payment handler</a> would roll back | ||
a transaction or issue a refund. (This is out of scope.) The <a>payment |
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.
Note, this whole talk of "refunds" and other "money talk" is not ideal. We should only talk about how we manipulate things in the API - but not go into this kind of detail. We can describe "here is how you do a refund" in tutorial material.
<p> | ||
Implementations may impose a timeout for developers to respond to the | ||
<a>AbortPaymentEvent</a>. If the timeout expires, then the | ||
implementation will behave as if <a data-lt= |
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.
Nit: there is no need to use data-lt
:) Just add data-link-for="AbortPaymentEvent"
in a parent element (either the paragraph or the parent <section>
).
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.
That's a neat trick, thank you!
<dfn>onabortpayment</dfn> attribute | ||
</h2> | ||
<p> | ||
The <a>onabortpayment</a> attribute is an <a>event handler</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.
Nit: <a>event handler</a>
should be <a>event handler attribute</a>
and linked to HTML correctly.
<a>PaymentRequestEvent</a> that is being processed. | ||
</li> | ||
<li>If <var>registration</var> is not found, reject the | ||
<a>Promise</a> that was created by <a data-cite= |
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.
So, I don't think we can do this... we need to hook back into Payment Request here - but we can't reach across threads and reject the promise?
</li> | ||
<li>Invoke the <a>handle functional event</a> algorithm with a | ||
<a>ServiceWorkerRegistration</a> of <var>registration</var> and <var> | ||
callbackSteps</var> set to the following steps: |
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.
Maybe we want some kinda of task here? This looks like a task.
<li>Invoke the <a>handle functional event</a> algorithm with a | ||
<a>ServiceWorkerRegistration</a> of <var>registration</var> and <var> | ||
callbackSteps</var> set to the following steps: | ||
<ol> |
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 shouldn't need to do any of this... Payment Request should do this for us. We just need to tell Payment Request that we have aborted, and it should do all this, no?
</li> | ||
<li>Dispatch <var>e</var> to <var>global</var>. | ||
</li> | ||
<li>Wait for all of the promises in the <a>extend lifetime |
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.
This feels out of place to me. Shouldn't we get this for free from .waitUntil() without needing to say anything? Hopefully this whole task can go away.
response, reject the <a>Promise</a> that was created by | ||
<a data-cite= | ||
"!payment-request#abort-method">PaymentRequest.abort()</a> with a | ||
<a>DOMException</a> whose value "<a>OperationError</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.
You can remove this whole thing. Payment Request doesn't know anything about "OperationError"s and WebIDL will just coerce anything you send into .respondeWith()
into a boolean.
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.
...anyway, I'm kinda sure this whole thing needs to go away. Fingers crossed!
Let me close this pull request and submit a new one. |
Preview | Diff