Re: [w3c/browser-payment-api] Need to define the interaction of payment API with navigation and browsing context destruction (#360)

OK, most of the easy stuff has been fixed or PRed; now time to tackle this one.

First, what are the concrete, web-observable cases we're concerned with here, where one of the things Boris listed could happen? My enumeration is as follows, but please check it:

- (A) A payment request is being shown. The user has not accepted the payment request. Suddenly, things happen.
- (B) A payment request has been shown. The user has accepted the payment request, and the browser is still in the process of signaling back to the main thread, when suddenly, things happen.
- (C) A payment request is being shown. The user manipulates the UI in a way that is supposed to update the main thread (e.g., changing the shipping option or address), and the browser is still in the process of signaling back to the main thread, when suddenly, things happen.

Does this cover it?

If so, I think what we need then is:

- We insert a blanket "should" clause that if things happen, all payment request-related UI should be hidden. (case A)
  - This means the promise stays pending forever. This seems most consistent since I don't see anything in the spec saying "if the user rejects the payment request, reject the promise". Maybe that's a separate spec bug?
- The "user accepts a payment request algorithm" needs to do a check that things have not happened before it proceeds to start doing interesting things (i.e. steps 5 onward, where it creates a PaymentResponse). If things have happened, reject request.[[acceptPromise]] with an "AbortError" DOMException. (case B)
  - We may also want to suggest that user agents tell the user "actually, your payment didn't go through" for case B.
- The tasks queued (post #405) for the shipping option changes need to do a check to see if things have happened. If things have happened, they should do nothing. (case C)

I've been using "things happen" to mean all the things @bzbarsky lists in his original post. @bzbarsky, do you think this captures that, in precise spec terms? Things have happened if "the PaymentRequest's relevant global object's Document is no longer fully active."

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/browser-payment-api/issues/360#issuecomment-274213058

Received on Saturday, 21 January 2017 00:11:04 UTC