Skip to content

Figure out places where we should use USVString #784

@kainino0x

Description

@kainino0x

Something recently reminded me about the existence of USVString. According to WebIDL:

Specifications should only use USVString for APIs that perform text processing and need a string of Unicode scalar values to operate on. Most APIs that use strings should instead be using DOMString, which does not make any interpretations of the code units in the string. When in doubt, use DOMString.

I think this means we should probably use USVString for GPUShaderModuleDescriptor.code, and probably GPUProgrammableStageDescriptor.entryPoint. I'm not 100% sure whether we should use it in other places.

I did some quick reading, and my understanding is that DOMStrings which are not valid USVStrings (i.e. they have invalid surrogate pairs) cannot be converted to UTF-8. Most or all of our other DOMString inputs (labels and debug names) are fed into the GPU driver as UTF-8 at some point. So I think we cannot actually accept DOMString for those.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions