script: Use CString for Error::Type and Error::Range (#42576)

Continuation of https://github.com/servo/servo/pull/42135, switch
Error::Type and Error::Range to also use CStrings internally, as they
are converted to CString for throwing JS exceptions (other get thrown as
DomException object, which uses rust string internally).

Changes in script crate are mechanical.

Testing: Should be covered by WPT tests.
Part of #42126

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
This commit is contained in:
Sam
2026-02-12 16:17:30 +01:00
committed by GitHub
parent c67143634a
commit d5d400c7d6
105 changed files with 440 additions and 437 deletions

View File

@@ -7,6 +7,7 @@
use dom_struct::dom_struct;
use indexmap::IndexMap;
use js::rust::HandleObject;
use script_bindings::cformat;
use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::codegen::Bindings::TestBindingMaplikeWithInterfaceBinding::TestBindingMaplikeWithInterfaceMethods;
@@ -79,7 +80,7 @@ impl TestBindingMaplikeWithInterfaceMethods<crate::DomTypeHolder>
self.internal
.borrow()
.get(&key)
.ok_or_else(|| Error::Type(format!("No entry for key {key}")))
.ok_or_else(|| Error::Type(cformat!("No entry for key {key}")))
.cloned()
}