script_bindings: Remove jsstring_to_str (#38527)

This PR removes `jsstring_to_str`, which is replaced with
`jsstr_to_string`, and updates `mozjs` to
6f3dcb99a7.

Given that servo now always replaces unpaired surrogate since
https://github.com/servo/servo/pull/35381, the internal conversion
function `jsstring_to_str` is functionally the same as `jsstr_to_string`
from `mozjs`. This PR removes `jsstring_to_str` and replaces with
`jsstr_to_string` with conversions to `DOMString` where necessary.

Testing: Passes all unit test. No regression was found in WPT test (see
try run: https://github.com/minghuaw/servo/actions/runs/16821156583)

---------

Signed-off-by: minghuaw <wuminghua7@huawei.com>
Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
Co-authored-by: sagudev <16504129+sagudev@users.noreply.github.com>
This commit is contained in:
minghuaw 2025-08-09 19:50:14 +08:00 committed by GitHub
parent a3e0a34802
commit ad18638534
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 49 additions and 81 deletions

View file

@ -9,6 +9,7 @@ use cssparser::{Parser, ParserInput};
use dom_struct::dom_struct;
use euclid::Angle;
use euclid::default::{Transform2D, Transform3D};
use js::conversions::jsstr_to_string;
use js::jsapi::JSObject;
use js::jsval;
use js::rust::{CustomAutoRooterGuard, HandleObject, ToString};
@ -24,7 +25,6 @@ use crate::dom::bindings::codegen::Bindings::DOMMatrixBinding::{
use crate::dom::bindings::codegen::Bindings::DOMMatrixReadOnlyBinding::DOMMatrixReadOnlyMethods;
use crate::dom::bindings::codegen::Bindings::DOMPointBinding::DOMPointInit;
use crate::dom::bindings::codegen::UnionTypes::StringOrUnrestrictedDoubleSequence;
use crate::dom::bindings::conversions::jsstring_to_str;
use crate::dom::bindings::error;
use crate::dom::bindings::error::Fallible;
use crate::dom::bindings::inheritance::Castable;
@ -835,11 +835,9 @@ impl DOMMatrixReadOnlyMethods<crate::DomTypeHolder> for DOMMatrixReadOnly {
unsafe {
rooted!(in(*cx) let mut rooted_value = value);
let serialization = ToString(*cx, rooted_value.handle());
jsstring_to_str(
*cx,
ptr::NonNull::new(serialization).expect("Pointer cannot be null"),
)
let serialization = std::ptr::NonNull::new(ToString(*cx, rooted_value.handle()))
.expect("Pointer cannot be null");
jsstr_to_string(*cx, serialization)
}
};