Intent to Ship: SerialPort forget()

91 views
Skip to first unread message

François Beaufort 🇫🇷

unread,
Apr 11, 2022, 4:58:18 AM4/11/22
to blink-dev

Contact emails

fbea...@google.com

rei...@google.com


Explainer

N/A


Specification

https://github.com/WICG/serial/pull/161

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


Summary

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


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

[2] https://groups.google.com/a/chromium.org/g/blink-dev/c/pSM2W0TtKEI/



Blink component

Blink>Serial


Motivation

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

const port = await navigator.serial.requestPort();


// Then later... revoke permission to the serial port.

await port.forget();

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 SerialPort object does not change the overall status of Serial API 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/serial/issues/132


[1] Both Gecko and WebKit are unlikely to object to this feature specifically, but object to the overall Serial 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 (Serial API 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/serial 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

102


Link to entry on the Chrome Platform Status

https://chromestatus.com/feature/5145811414417408

Mike Taylor

unread,
Apr 11, 2022, 1:49:08 PM4/11/22
to François Beaufort 🇫🇷, blink-dev
--
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/CAPpwU5KJD9m-XjbbYx1_CXHiu_WeLLkeaPGQ%3DxD5usm4yP_b%2BQ%40mail.gmail.com.


Yoav Weiss

unread,
Apr 11, 2022, 2:25:27 PM4/11/22
to Mike Taylor, François Beaufort 🇫🇷, blink-dev

Chris Harrelson

unread,
Apr 11, 2022, 2:28:41 PM4/11/22
to Yoav Weiss, Mike Taylor, François Beaufort 🇫🇷, blink-dev
Could you fill in an answer to the question about WebView compatibility? Is this API exposed on webview and is it tested there?

François Beaufort 🇫🇷

unread,
Apr 11, 2022, 2:44:31 PM4/11/22
to Chris Harrelson, Yoav Weiss, Mike Taylor, blink-dev
On Mon, Apr 11, 2022 at 8:28 PM Chris Harrelson <chri...@chromium.org> wrote:
Could you fill in an answer to the question about WebView compatibility? Is this API exposed on webview and is it tested there?

The Web Serial API is available only on desktop platforms (Chrome OS, Linux, macOS, and Windows).

Chris Harrelson

unread,
Apr 11, 2022, 2:55:38 PM4/11/22
to François Beaufort 🇫🇷, Yoav Weiss, Mike Taylor, blink-dev
Reply all
Reply to author
Forward
0 new messages