[presentation-api] PresentationRequest.getAvailability() could always return a new Promise (#507)

mfoltzgoogle has just created a new issue for https://github.com/w3c/presentation-api:

== PresentationRequest.getAvailability() could always return a new Promise ==
The [steps for `getAvailability()`](https://www.w3.org/TR/presentation-api/#getting-the-presentation-displays-availability-information) have an optimization (?) to return (sometimes) a pre-existing `Promise` from a previous call to `getAvailability()`.

However this isn't consistent with other specs that always return a new `Promise` when starting an asynchronous action on another device:

  - [`scan()` in Web NFC](https://w3c.github.io/web-nfc/#the-scan-method)
  - [`open()` in Web USB](https://wicg.github.io/webusb/#usbdevice-methods)
  - [`requestPort()` in Web Serial](https://wicg.github.io/serial/#requestport-method)
  - [`watchAdvertisements()` in Web Bluetooth](https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothdevice-watchadvertisements)

Those are a few examples pulled by skimming other specs, there are likely more.

The Promise-caching also produces some implementation complexity because the browser must sometimes store the Promise like a property of the request, and sometimes allocate a new object and pass it directly to script.

It would be simpler to implement, and more consistent with other specs, to always return a new Promise here.


Please view or discuss this issue at https://github.com/w3c/presentation-api/issues/507 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Friday, 30 September 2022 17:22:56 UTC