Intent to Ship: HIDDevice forget()

236 views
Skip to first unread message

François Beaufort 🇫🇷

unread,
Feb 8, 2022, 3:42:23 AM2/8/22
to blink-dev

Contact emails

fbea...@google.com

mattre...@google.com


Explainer

https://github.com/WICG/webhid/blob/main/EXPLAINER.md


Specification

https://wicg.github.io/webhid/#forget-method

https://github.com/WICG/webhid/pull/84


Summary

The HIDDevice forget() method allows web developers to voluntarily revoke a permission to a HIDDevice that was granted by a user.


Blink component

Blink>HID


Motivation

Some sites may not be interested in retaining long-term permissions to access a HID device. For example, for an educational web application used on a shared computer with many devices, a large number of accumulated user-generated permissions creates a poor user experience.
In addition to user agent mitigations to avoid this problem, such as defaulting to a session scoped permission on the first request or expiring infrequently used permissions, it should be possible for the site itself to clean up user-generated permissions it is no longer interested in retaining.


// Request a HID device.

const [device] = await navigator.hid.requestDevice({ filters: [] });


// Then later... revoke permission to the HID device.

await device.forget();

We expect similar functionality to Web Bluetooth, WebUSB, and the Serial API to be added.


TAG review

https://github.com/w3ctag/design-reviews/issues/703


TAG review status

Pending


Risks


Interoperability and Compatibility


This small addition to the HIDDevice object does not change the overall status of WebHID interoperability or compatibility.


Signals from other implementations (Gecko, WebKit): 


Gecko: No Signal [1]

WebKit: No Signal [1]

Web / Framework developers: Positive https://github.com/WICG/webhid/issues/39

Other signals: Google Meet folks have tried it and strongly support this addition.


[1] Both Gecko and WebKit are unlikely to object to this feature specifically, but object to the overall WebHID API as a whole, hence it doesn't make sense to bug them with specific questions on this.


Activation:

This feature can't be polyfilled. It should be fairly trivial for developers to adopt this new feature.


Debuggability

No specific DevTools changes are required. This feature is treated like any other JS method.

Note that exposing DevTools debugging support for device-access APIs (WebHID included) is discussed at https://bugs.chromium.org/p/chromium/issues/detail?id=1142566.


Is this feature fully tested by web-platform-tests?

No, because permission storage is implemented outside of Blink and so isn’t testable by web-platform-tests. Some tests that only verify the presence of interfaces and attributes will be available at https://wpt.fyi/results/webhid though.


Requires code in //chrome?

Yes, permission storage is implemented in //chrome.


Tracking bug

https://bugs.chromium.org/p/chromium/issues/detail?id=1279822


Estimated milestones

100


Link to entry on the Chrome Platform Status

https://chromestatus.com/feature/5723581527883776


Links to previous Intent discussions

Intent to prototype: https://groups.google.com/a/chromium.org/g/blink-dev/c/c2vCYr-0dqk/m/3nSeViRLCgAJ

Yoav Weiss

unread,
Feb 9, 2022, 4:27:58 AM2/9/22
to blink-dev, François Beaufort
LGTM1. Seems like a small and useful addition.

Daniel Bratell

unread,
Feb 9, 2022, 5:44:57 AM2/9/22
to Yoav Weiss, blink-dev, François Beaufort

LGTM2

About web tests, is there no method that behaves differently in an observable way when the permission isn't given?

/Daniel

--
You received this message because you are subscribed to the Google Groups "blink-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/bbd12314-8ade-4a84-a31c-dea7964344dcn%40chromium.org.

Mike West

unread,
Feb 9, 2022, 12:55:54 PM2/9/22
to Daniel Bratell, Yoav Weiss, blink-dev, François Beaufort

Matt Reynolds

unread,
Feb 14, 2022, 2:24:05 PM2/14/22
to Mike West, Daniel Bratell, Yoav Weiss, blink-dev, François Beaufort
> About web tests, is there no method that behaves differently in an observable way when the permission isn't given?

If the device is connected then navigator.hid.getDevices() will return an array containing a HIDDevice representing the device, but the API doesn't provide a way to learn about disconnected devices. Currently we don't have a way to simulate a connected device for WPT.

Reply all
Reply to author
Forward
0 new messages