[sensors] Add API for requesting permission (#388)

anssiko has just created a new issue for https://github.com/w3c/sensors:

== Add API for requesting permission ==
Generic Sensor API was defined with an expectation the generic `navigator.permissions.request()` would materialize at some point, but since `request()` seem not be gaining support among implementers we should look at other options. Currently, two approaches to programmatically request permission have been coined and one of them tried on the web platform:

* Generic [`navigator.permissions.request()`](https://wicg.github.io/permissions-request/#dom-permissions-request) 
  * Spec: WICG spec spun off from [Permissions API](https://w3c.github.io/permissions/) that defines [`navigator.permissions.query()`](https://w3c.github.io/permissions/#dom-permissions-query)
  * Implementations: none
* Concrete `Foobar.requestPermission()` 
  * Spec: [Notifications API](https://notifications.spec.whatwg.org/#dom-notification-requestpermission), considered for [Device Orientation](https://github.com/w3c/deviceorientation/issues/57); dropped from [Payment Handler API](https://github.com/w3c/payment-handler/issues/246)
  * Implementations: Chrome seem to pass [wpt test case](https://w3c-test.org/notifications/shownotification-resolve-manual.https.html) (wpt.fyi not running these interactive tests), per [MDN](https://developer.mozilla.org/en-US/docs/Web/API/Notification/requestPermission) others implement too but unable to validate

Opened this issue to gauge interest to revisit concrete `requestPermission()` again given it has been getting some traction recently (see Device Orientation). If there's support for this idea, we could add informative guidance to [Extensibility](https://w3c.github.io/sensors/#extensibility) for concrete spec authors that subclass `Sensor` to utilize.

Please view or discuss this issue at https://github.com/w3c/sensors/issues/388 using your GitHub account

Received on Monday, 11 March 2019 13:16:30 UTC