Re: [w3c/payment-handler] Remove PaymentRequestEvent and CanMakePaymentEvent from ServiceWorker Scope? (#304)

@gogerald

> I mean remove 'Exposed=ServiceWorker', which indicates that the construct is exposed on 'ServiceWorker' set of interfaces, right?

If we remove `Exposed=ServiceWorker`, we can not listen to the events in SW global scope. As far as I know, we should declare `Exposed` explicitly for all interfaces in latest web platform. In Chrome binding, if there is no `Exposed`, it is the same with `Exposed=Window`.

You might have wanted to remove constructors of those events. If so, developers would not be able to create event objects explicitly.

> I don't see we have use cases that need to construct PaymentRequestEvent and CanMakePaymentEvent in service worker. Did I understand it wrong?

Removing the constructors might be allowed in the spec perspective[1][2] but it's also important to have platform consistency where possible[3]. One use-case is so that we write tests for payment handler. We are already using it usefully[4].

[1] https://dom.spec.whatwg.org/#constructing-events
[2] https://dom.spec.whatwg.org/#defining-event-interfaces
[3] https://groups.google.com/a/chromium.org/d/msg/blink-dev/G3V0F7Rh0Io/MuLBeUZeAQAJ
[4] [Chromium test code](https://cs.chromium.org/chromium/src/third_party/WebKit/LayoutTests/http/tests/payments/resources/payment-request-event.js?q=payment-request-event.js&dr&l=18)

-- 
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-handler/issues/304#issuecomment-393403768

Received on Thursday, 31 May 2018 05:05:49 UTC