Re: [w3c/payment-handler] Does PaymentManager need to be exposed to Worker scope? (#340)

@romandev Sorry about the delay in responding to your comments! Please see inline below.

> Do you have any special reasons to introduce the restriction? For example, `requestPermission()` contained a permission UI prompt. As you know, the UI should be invoked on main thread. So the `[Exposed=Window]` restriction was added to `requestPermission()`.

I don't see this as a restriction. IMHO this is a case where the spec evolved beyond the implementation, and we now need to make a decision whether the implementation should follow the spec, or if we should revert the spec change if there is no longer a good reason for this to be in the spec.

> On the other hand, the `PaymentManager` is exposed as an attribute to extended `ServiceWorkerRegistration`. Today, we can access the `ServiceWorkerRegistration` in Worker scope(including ServiceWorker) as well as Window scope[1]. Therefore, it is reasonable that the attribute is exposed to the equivalent scope as `ServiceWorkerRegistration` if there is no special reasons.

Even without exposing the `PaymentManager` interface to Worker scope, service worker code can access its methods via the `registration.paymentManager` instance. I'm not convinced that consistency with `ServiceWorkerRegistration` scope without a concrete use case is enough justification to expand the scope.

WDYT?

-- 
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/340#issuecomment-519615399

Received on Thursday, 8 August 2019 17:33:03 UTC