-
Notifications
You must be signed in to change notification settings - Fork 368
Description
Something recently reminded me about the existence of USVString. According to WebIDL:
Specifications should only use
USVStringfor APIs that perform text processing and need a string of Unicode scalar values to operate on. Most APIs that use strings should instead be usingDOMString, which does not make any interpretations of the code units in the string. When in doubt, useDOMString.
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.