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

@ -7,7 +7,7 @@ use std::os::raw::{c_char, c_void};
use std::ptr::{self, NonNull};
use std::slice;
use js::conversions::ToJSValConvertible;
use js::conversions::{ToJSValConvertible, jsstr_to_string};
use js::gc::Handle;
use js::glue::{
AppendToIdVector, CallJitGetterOp, CallJitMethodOp, CallJitSetterOp, JS_GetReservedSlot,
@ -40,7 +40,7 @@ use crate::DomTypes;
use crate::codegen::Globals::Globals;
use crate::codegen::InheritTypes::TopTypeId;
use crate::codegen::PrototypeList::{self, MAX_PROTO_CHAIN_LENGTH, PROTO_OR_IFACE_LENGTH};
use crate::conversions::{PrototypeCheck, jsstring_to_str, private_from_proto_check};
use crate::conversions::{PrototypeCheck, private_from_proto_check};
use crate::error::throw_invalid_this;
use crate::interfaces::DomHelpers;
use crate::script_runtime::{CanGc, JSContext as SafeJSContext};
@ -222,7 +222,7 @@ pub(crate) unsafe fn find_enum_value<'a, T>(
) -> Result<(Option<&'a T>, DOMString), ()> {
match ptr::NonNull::new(ToString(cx, v)) {
Some(jsstr) => {
let search = jsstring_to_str(cx, jsstr);
let search = DOMString::from_string(jsstr_to_string(cx, jsstr));
Ok((
pairs
.iter()