mirror of
https://github.com/servo/servo
synced 2026-05-09 08:32:31 +02:00
The current implementation would transfer the script string to `mozjs` without telling `mozjs` that the string is UTF-8 encoded, causing problems when the script carries Chinese characters. This PR fixes this by using a correct API `mozjs::jsapi::JS_NewStringCopyUTF8N`. Also changed `TrustedXxx::data()` to return a `&DOMString` to reduce one unnecessary cloning when transferring script string to `mozjs` Testing: Manual testing. Would like to ask for community ideas on introducing new test covering this --------- Signed-off-by: minghuaw <michael.wu1107@gmail.com>
54 KiB
54 KiB