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): derive required RTCError payload arguments

ldm0bd8e0b27a955
diff --git a/moli-renderer-v8/src/context_bootstrap/constructors/dom_exception/rtc_error.rs b/moli-renderer-v8/src/context_bootstrap/constructors/dom_exception/rtc_error.rs
index 8e9d37935..b2d9fa4c0 100644
--- a/moli-renderer-v8/src/context_bootstrap/constructors/dom_exception/rtc_error.rs
+++ b/moli-renderer-v8/src/context_bootstrap/constructors/dom_exception/rtc_error.rs
@@ -1,6 +1,6 @@
use super::*;
use crate::util::apply_webidl_constructor_prototype_fallback;
-use webidl::{WebIdlDictionary, WebIdlDictionarySerialize};
+use webidl::WebIdlDictionarySerialize;
const ERROR_DETAIL: &str = "__moliRtcErrorDetail";
const SDP_LINE_NUMBER: &str = "__moliRtcErrorSdpLineNumber";
@@ -40,30 +40,12 @@ struct ErrorInit {
#[derive(webidl::WebIdlArgs)]
#[webidl(prefix = "RTCError")]
struct ConstructorArgs {
- #[webidl(required, with = parse_init_arg)]
+ #[webidl(required, dictionary)]
init: ErrorInit,
#[webidl(default = webidl::DomString16(Vec::new()), converter = "raw")]
message: webidl::DomString16,
}
-fn parse_init_arg<'s>(
- scope: &mut v8::PinScope<'s, '_>,
- args: &v8::FunctionCallbackArguments<'s>,
- index: i32,
-) -> Result<ErrorInit, webidl::WebIdlError> {
- let object = webidl::dictionary_value(
- args.get(index),
- webidl::Context::argument("RTCError", (index + 1) as usize),
- )?
- .ok_or_else(|| {
- webidl::WebIdlError::missing_required(webidl::Context::member(
- "RTCErrorInit",
- "errorDetail",
- ))
- })?;
- ErrorInit::parse_dictionary(scope, object)
-}
-
#[derive(WebApiObject)]
#[webapi(interface = web_api_interfaces::RTCError)]
struct ObjectDeclaration<'s> {