-
Notifications
You must be signed in to change notification settings - Fork 344
Description
Hi WebGPU WG,
I'm writing to raise several concerns about GPUObjectBase's label and GPUDeviceLostInfo's message.
Tl;dr the concerns with these attributes are:
- Could serve as potential fingerprinting vectors.
- Generally not localized, and could end up being displayed to users - leading to a less than ideal user experience!
- Non-idiomatic use of
undefinedfor a WebIDL attribute value. - Includes errors/warnings that could just be presented in the developer console
Quick solution: To remedy the above, I strongly suggest removing these attributes from the specification.
Potential fingerprinting vector
Because "message set to an implementation-defined value", it risks being unique per implementation. This adds to the fingerprinting surface and variance between user agents.
For label, the spec even notes:
label which can be used by development tools (such as error/warning messages, browser developer tools, or platform debugging utilities) to identify the underlying internal object to the developer. It has no specified format, and therefore cannot be reliably machine-parsed.
Then it shouldn't be part of the spec. The fact that it is there means that it will most definitely will be parsed and it will be relied on by developers leading to unexpected interoperability issues.
Localization
Generally, developer facing error messages are not localized. Consider, Geolocation suffers from this issue across all user agents.
As happened with the Geolocation API, these messages end up being shown to end users. Developers often don't realize that these messages are not localized. For example in Blink (same in WebKit, btw... and also in Gecko):
https://chromium.googlesource.com/chromium/blink/+/refs/heads/main/Source/modules/geolocation/Geolocation.cpp#47
Sites are relying these, which means they can't be changed. Please avoid making this same mistake in WebGPU.
Non-idiomatic use of undefined.
Consider: nowhere else in the platform does one find attribute undefined as a type (or as a union), as having a property that is defined yet undefined is highly confusing.
I don't recommend the following either, but even Gecko has set message and label to nullable (USVString?) (also, the choice of USVString seems odd... should probably be aDOMString... but dropping it entirely is better):
https://searchfox.org/mozilla-central/source/dom/webidl/WebGPU.webidl#51
Show errors/warnings directly in the developer console
Instead of exposing GPUObjectBase's label and GPUDeviceLostInfo's message, please recommend user agents route developer messages directly to the developer console. Presenting info/warning/error messages in the developer console without also exposing the a .message in the API is already common practice in the platform.
The above is not from an API, the browser just does the right thing. There are tens, if not hundreds, of these little helpful warnings that show up in the developer console. They are easy to implement in user agents too and provide the best developer experience (including direct access to where the error occurred for debugging etc.).