Skip to content

armgit / moli

Public Imported from GitHub
0

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

refactor(webrtc): derive required ICE error event payload arguments

ldm09861c31e88e3
diff --git a/moli-renderer-v8/src/context_bootstrap/webrtc/ice_error_event.rs b/moli-renderer-v8/src/context_bootstrap/webrtc/ice_error_event.rs
index 3fc84943f..39b14d2b1 100644
--- a/moli-renderer-v8/src/context_bootstrap/webrtc/ice_error_event.rs
+++ b/moli-renderer-v8/src/context_bootstrap/webrtc/ice_error_event.rs
@@ -10,7 +10,7 @@ use crate::{
web_api_interfaces, webidl,
};
use moli_webapi_declare::WebApiFunctionTemplate;
-use webidl::{WebIdlDictionary, WebIdlDictionarySerialize};
+use webidl::WebIdlDictionarySerialize;
const ADDRESS_SLOT: &str = "__moliRtcIceErrorAddress";
const PORT_SLOT: &str = "__moliRtcIceErrorPort";
@@ -53,28 +53,10 @@ struct Init {
struct Args {
#[webidl(required, converter = "raw")]
event_type: webidl::DomString16,
- #[webidl(required, with = parse_init_arg)]
+ #[webidl(required, dictionary)]
init: Init,
}
-fn parse_init_arg<'s>(
- scope: &mut v8::PinScope<'s, '_>,
- args: &v8::FunctionCallbackArguments<'s>,
- index: i32,
-) -> Result<Init, webidl::WebIdlError> {
- let object = webidl::dictionary_value(
- args.get(index),
- webidl::Context::argument("RTCPeerConnectionIceErrorEvent", (index + 1) as usize),
- )?
- .ok_or_else(|| {
- webidl::WebIdlError::missing_required(webidl::Context::member(
- "RTCPeerConnectionIceErrorEventInit",
- "errorCode",
- ))
- })?;
- Init::parse_dictionary(scope, object)
-}
-
#[derive(WebApiFunctionTemplate)]
#[webapi(interface = web_api_interfaces::RTCPeerConnectionIceErrorEvent, receiver, enumerable)]
struct PrototypeDeclaration {