.
Created attachment 457219 [details] Patch
Comment on attachment 457219 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=457219&action=review > Source/WebGPU/WebGPU/Adapter.mm:137 > + auto label = String::fromUTF8(descriptor.label); Aren't these coming from the API? E.g. would fromAPI() be more appropriate?
Comment on attachment 457219 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=457219&action=review >> Source/WebGPU/WebGPU/Adapter.mm:137 >> + auto label = String::fromUTF8(descriptor.label); > > Aren't these coming from the API? E.g. would fromAPI() be more appropriate? Good point.
Committed r292748 (?): <https://commits.webkit.org/r292748>
<rdar://problem/91598857>
Comment on attachment 457219 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=457219&action=review > Source/WebGPU/ChangeLog:8 > + Replace String::fromLatin1() with String::fromUTF8(). Great to fix this if it was going to mishandle non-ASCII characters. But note that now there is a failure case for all of these, if it’s invalid UTF-8. This is a major difference between String::fromUTF8 and String::fromLatin1, and might eventually lead to us renaming it to String::tryFromUTF8. As long as each caller either has a guarantee it will be valid UTF-8, or can withstand a null string result when it’s not, we are OK.
Comment on attachment 457219 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=457219&action=review >> Source/WebGPU/ChangeLog:8 >> + Replace String::fromLatin1() with String::fromUTF8(). > > Great to fix this if it was going to mishandle non-ASCII characters. But note that now there is a failure case for all of these, if it’s invalid UTF-8. This is a major difference between String::fromUTF8 and String::fromLatin1, and might eventually lead to us renaming it to String::tryFromUTF8. > > As long as each caller either has a guarantee it will be valid UTF-8, or can withstand a null string result when it’s not, we are OK. Right. For this situation, it's the latter.