Files
servo/components/script/script_runtime.rs
minghuaw 975eb988e6 script: Fix script string transfered to mozjs with wrong encoding (#39799)
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>
2025-10-15 07:42:11 +00:00

54 KiB