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

@@ -303,7 +303,7 @@ impl HTMLFormElementMethods<crate::DomTypeHolder> for HTMLFormElement {
Some(submitter_element) => {
// Step 1.1
let error_not_a_submit_button =
Err(Error::Type("submitter must be a submit button".to_string()));
Err(Error::Type(c"submitter must be a submit button".to_owned()));
let element = match submitter_element.upcast::<Node>().type_id() {
NodeTypeId::Element(ElementTypeId::HTMLElement(element)) => element,