Re: [w3c/payment-request] Reject promise if document becomes not fully active (#872)

Thanks @marcoscaceres for the pointers!

I'm getting some push back from Blink architecture owners for adding a new hook without a real world use case. After thinking about this a bit more, it seems that the only scenario where the spec'ed behavior is critical is if a reference to the promise is retained in a different context after the document associated with the promise becomes inactive.

Concretely, I can only think of one scenario where this would be the case:

1. Top-level frame embeds a **same-origin** iframe that creates a PaymentRequest object, e.g. `request`
1. `request.show()` is called inside the iframe and the returned Promise (e.g. `acceptPromise`) is passed back to the top-level frame, e.g. to update UI after the promise resolves.
1. iframe navigates so the document associated with `acceptPromise` is no longer a fully active document
1. Top-level frame code hangs because `acceptPromise` stays unsettled.

If the iframe was not same-origin as the top-level frame, it wouldn't have been able to pass `acceptPromise` in step 2, which is needed to get ourselves into a scenario where a reference to `acceptPromise` exists but its associated document is no longer active.

I suspect almost all of the PaymentRequests made from iframes are from cross-origin iframes. I'm going to add some telemetry to verify this.

If the same-origin use case turns out to be non-existent, then it seems to me that we don't have a real world use case that would depend on the current spec behavior. Then can we remove the spec that the promise must be rejected if the document becomes inactive after the promise is created?


-- 
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/payment-request/issues/872#issuecomment-511946448

Received on Tuesday, 16 July 2019 19:08:48 UTC