Skip to content

armgit / moli

Public Imported from GitHub
0

Best headless browser for AI agents. Lite, Fast, High-Compatibility. Built in Rust

refactor(webidl): share DOMString conversion through UTF-16

ldm0b8e7b6b27b74
diff --git a/moli-webidl/src/convert.rs b/moli-webidl/src/convert.rs
index a0d934ea6..f452a6506 100644
--- a/moli-webidl/src/convert.rs
+++ b/moli-webidl/src/convert.rs
@@ -16,17 +16,8 @@ impl<'s> WebIdlConverter<'s> for DomString {
context: Context,
options: &Self::Options,
) -> Result<Self, WebIdlError> {
- if value.is_null() && options.treat_null_as_empty_string {
- return Ok(Self(String::new()));
- }
- if value.is_symbol() {
- return Err(WebIdlError::new(
- context,
- WebIdlErrorKind::CannotConvert("DOMString"),
- ));
- }
- string_value_utf16(scope, value, context, "DOMString")
- .map(|value| Self(String::from_utf16_lossy(&value)))
+ DomString16::convert(scope, value, context, options)
+ .map(|value| Self(String::from_utf16_lossy(&value.0)))
}
}