diff --git a/index.html b/index.html index 8c35779..f73ff86 100644 --- a/index.html +++ b/index.html @@ -923,12 +923,80 @@

- respondWith() method + respondWith() method

This method is used by the payment handler to indicate whether it - can respond to a payment request. + can respond to a payment request. The + respondWith(canMakePaymentPromise) method MUST act as + follows:

+
    +
  1. Let event be this CanMakePaymentEvent + instance. +
  2. +
  3. If event's isTrusted attribute is false, then + throw an "InvalidStateError" DOMException. +
  4. +
  5. If event's dispatch flag is unset, then + throw an "InvalidStateError" DOMException. +
  6. +
  7. If event.[[\resultPromise]] is not null, + throw an "InvalidStateError" DOMException. +
  8. +
  9. Set event.[[\resultPromise]] to + PaymentRequest's canMakePaymentPromise. +
  10. +
  11. Set the event's stop propagation flag and + event's stop immediate propagation flag. +
  12. +
  13. Add canMakePaymentPromise to the event's + extend lifetime promises. +
  14. +
  15. Increment the event's pending promises count + by one. +
  16. +
  17. Upon fulfillment or rejection of + canMakePaymentPromise, queue a microtask to perform the + following steps: +
      +
    1. Decrement the event's pending promises + count by one. +
    2. +
    3. Let registration be the context object's relevant global object's + associated service worker's containing service worker + registration. +
    4. +
    5. If registration’s uninstalling flag is + set, invoke Try Clear Registration with + registration. +
    6. +
    7. If registration is not null, invoke Try + Activate with registration. +
    8. +
    +
  18. +
  19. Upon fulfillment of canMakePaymentPromise + with value value, +
      +
    1. Resolve the pending promise + event.[[\resultPromise]] with + value. +
    2. +
    +
  20. +
  21. Upon rejection of canMakePaymentPromise, +
      +
    1. Resolve the pending promise + event.[[\resultPromise]] with false. +
    2. +
    +
  22. +

@@ -990,6 +1058,16 @@

  • Dispatch e to global.
  • +
  • If e.[[\resultPromise]] is null, then: +
      +
    1. Set e.[[\resultPromise]] to + PaymentRequest's canMakePaymentPromise. +
    2. +
    3. Resolve e.[[\resultPromise]] with + false. +
    4. +
    +
  • Wait for all of the promises in the extend lifetime promises of e to resolve.
  • @@ -1424,6 +1502,35 @@

    Internal Slots

    +

    + Instances of CanMakePaymentEvent are created with the internal + slots in the following table: +

    + + + + + + + + + + + +
    + Internal Slot + + Default Value + + Description (non-normative) +
    + [[\resultPromise]] + + null + + This value is set to the pending promise to get back the result + when event is triggered from the associated PaymentRequest. +

    Instances of PaymentRequestEvent are created with the internal slots in the following table: @@ -2270,10 +2377,10 @@

    handle functional event, extend lifetime - promises,pending promises - count, extend + lifetime promises,pending + promises count, containing service worker registration, uninstalling flag,