Intent to Ship: USBDevice forget()

92 views
Skip to first unread message

François Beaufort 🇫🇷

unread,
Feb 23, 2022, 2:34:57 AMFeb 23
to blink-dev

Contact emails

fbea...@google.com

rei...@google.com


Explainer

N/A


Specification

https://wicg.github.io/webusb/#ref-for-dom-usbdevice-forget

https://github.com/WICG/webusb/pull/214


Summary

Following the recent HIDDevice forget() addition[1] to the web platform, the USBDevice forget() method allows web developers to voluntarily revoke a permission to a USBDevice that was granted by a user.


[1] https://groups.google.com/a/chromium.org/g/blink-dev/c/Fk-IJF63UWc


Blink component

Blink>USB


Motivation

Some sites may not be interested in retaining long-term permissions to access a USB 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 USB device.

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


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

await device.forget();

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


TAG review

Following recent HIDDevice forget() approval [1], a new TAG review does not seem necessary.


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


TAG review status

N/A


Risks


Interoperability and Compatibility


This small addition to the USBDevice object does not change the overall status of WebUSB 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/webusb/issues/107


[1] Both Gecko and WebKit are unlikely to object to this feature specifically, but object to the overall WebUSB 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 (WebUSB 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/webusb though. I’ll also add manual tests.


Requires code in //chrome?

Yes, permission storage is implemented in //chrome.


Tracking bug

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


Estimated milestones

101


Link to entry on the Chrome Platform Status

https://chromestatus.com/feature/5640127995969536






Yoav Weiss

unread,
Feb 23, 2022, 5:44:06 AMFeb 23
to François Beaufort 🇫🇷, blink-dev
LGTM1
I agree this is close enough to HID.forget() to not require a full-fledged TAG review, but maybe add a comment on the HID review letting them know that you plan to apply the same pattern to USB?

--
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/CAPpwU5KgNO-kK%3DS-d_X-FxL3AvKmAmEC99%2B67vzxZgRmv2Bt3A%40mail.gmail.com.

mkwst via Chromestatus

unread,
Feb 23, 2022, 8:38:00 AMFeb 23
to blin...@chromium.org
LGTM2. As Yoav notes, this seems like a straightforward addition, in line with previous additions we've also approved.

Chris Harrelson

unread,
Feb 23, 2022, 11:07:14 AMFeb 23
to mkwst via Chromestatus, blink-dev
LGTM3. Please also merge the PR before shipping.

On Wed, Feb 23, 2022 at 5:37 AM mkwst via Chromestatus <admin...@cr-status.appspotmail.com> wrote:
LGTM2. As Yoav notes, this seems like a straightforward addition, in line with previous additions we've also approved.

--
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.

slightlyoff via Chromestatus

unread,
Feb 23, 2022, 11:42:24 AMFeb 23
to blin...@chromium.org
Thanks for adding this to more APIs. Great to see.

François Beaufort 🇫🇷

unread,
Feb 23, 2022, 2:50:19 PMFeb 23
to Chris Harrelson, mkwst via Chromestatus, blink-dev
On Wed, Feb 23, 2022 at 5:07 PM Chris Harrelson <chri...@chromium.org> wrote:
LGTM3. Please also merge the PR before shipping.

Done. https://github.com/WICG/webusb/pull/214 has just been merged.
 

François Beaufort 🇫🇷

unread,
Feb 23, 2022, 2:50:57 PMFeb 23
to Yoav Weiss, blink-dev
On Wed, Feb 23, 2022 at 11:43 AM Yoav Weiss <yoav...@chromium.org> wrote:
LGTM1
I agree this is close enough to HID.forget() to not require a full-fledged TAG review, but maybe add a comment on the HID review letting them know that you plan to apply the same pattern to USB?

 
Reply all
Reply to author
Forward
0 new messages