Best headless browser for AI agents. Lite, Fast, High-Compatibility. Built in Rust
Rust ai-agentsai-toolsbrowserbrowser-automationcloud-browserheadlessheadless-browserkitesurfplaywrightpuppeteerrustservoweb-crawlerweb-crawlingweb-scraperweb-scraping
refactor(events): derive nested device and WebMCP dictionaries
ldm066b76317b001
diff --git a/moli-renderer-v8/src/context_bootstrap/events/device.rs b/moli-renderer-v8/src/context_bootstrap/events/device.rsindex 32b4bf5ba..bd379049c 100644--- a/moli-renderer-v8/src/context_bootstrap/events/device.rs+++ b/moli-renderer-v8/src/context_bootstrap/events/device.rs@@ -127,13 +127,13 @@ struct MotionInit {cancelable: bool,#[webidl(default = false)]composed: bool,- #[webidl(with = acceleration_member)]+ #[webidl(dictionary)]acceleration: Option<AccelerationInit>,- #[webidl(name = "accelerationIncludingGravity", with = acceleration_member)]+ #[webidl(name = "accelerationIncludingGravity", dictionary)]acceleration_including_gravity: Option<AccelerationInit>,#[webidl(converter = "double", default = 0.0)]interval: f64,- #[webidl(name = "rotationRate", with = rotation_rate_member)]+ #[webidl(name = "rotationRate", dictionary)]rotation_rate: Option<RotationRateInit>,}@@ -159,40 +159,6 @@ struct RotationRateInit {gamma: Option<f64>,}-fn nested_dictionary_member<'s, T: webidl::WebIdlDictionary<'s> + Default>(- scope: &mut v8::PinScope<'s, '_>,- object: v8::Local<'s, v8::Object>,- name: &'static str,-) -> Result<Option<T>, webidl::WebIdlError> {- let context = webidl::Context::member("DeviceMotionEventInit", name);- let Some(value) = webidl::property_result(scope, object, name, context)?- .filter(|value| !value.is_undefined())- else {- return Ok(None);- };- // An absent member leaves the event attribute null. A present null member- // converts to an empty dictionary and creates a vector with null components.- Ok(Some(- webidl::parse_dictionary::<T>(scope, value, context)?.unwrap_or_default(),- ))-}--fn acceleration_member<'s>(- scope: &mut v8::PinScope<'s, '_>,- object: v8::Local<'s, v8::Object>,- name: &'static str,-) -> Result<Option<AccelerationInit>, webidl::WebIdlError> {- nested_dictionary_member(scope, object, name)-}--fn rotation_rate_member<'s>(- scope: &mut v8::PinScope<'s, '_>,- object: v8::Local<'s, v8::Object>,- name: &'static str,-) -> Result<Option<RotationRateInit>, webidl::WebIdlError> {- nested_dictionary_member(scope, object, name)-}-pub(in crate::context_bootstrap) fn install_device_event_template_bindings<'s>(scope: &mut v8::PinScope<'s, '_, ()>,template: v8::Local<'s, v8::FunctionTemplate>,diff --git a/moli-renderer-v8/src/context_bootstrap/web_mcp/conversion.rs b/moli-renderer-v8/src/context_bootstrap/web_mcp/conversion.rsindex 480b8c422..d6d029e5b 100644--- a/moli-renderer-v8/src/context_bootstrap/web_mcp/conversion.rs+++ b/moli-renderer-v8/src/context_bootstrap/web_mcp/conversion.rs@@ -21,7 +21,7 @@ pub(super) struct ToolAnnotations {#[derive(webidl::WebIdlDictionary)]#[webidl(prefix = "ModelContextTool")]pub(super) struct ToolDefinition<'s> {- #[webidl(with = annotations_member)]+ #[webidl(dictionary)]pub(super) annotations: Option<ToolAnnotations>,#[webidl(required, converter = "dom_string")]pub(super) description: String,@@ -61,7 +61,7 @@ pub(super) struct ExecuteOptions<'s> {#[derive(webidl::WebIdlDictionary)]#[webidl(prefix = "RegisteredTool")]pub(super) struct ToolReference<'s> {- #[webidl(with = annotations_member)]+ #[webidl(dictionary)]pub(super) annotations: Option<ToolAnnotations>,#[webidl(required, converter = "dom_string")]pub(super) description: String,@@ -91,24 +91,6 @@ pub(super) fn dictionary<'s>(.map(|value| value.unwrap_or_else(|| crate::util::new_null_prototype_object(scope)))}-fn annotations_member<'s>(- scope: &mut v8::PinScope<'s, '_>,- object: v8::Local<'s, v8::Object>,- name: &'static str,-) -> Result<Option<ToolAnnotations>, webidl::WebIdlError> {- let context = webidl::Context::member("ModelContextTool", name);- let Some(value) = webidl::property_result(scope, object, name, context)?- .filter(|value| !value.is_undefined())- else {- return Ok(None);- };- if value.is_null() {- return Ok(Some(ToolAnnotations::default()));- }- let dictionary = webidl::convert::<v8::Local<v8::Object>>(scope, value, context)?;- webidl::parse_dictionary_object::<ToolAnnotations>(scope, dictionary).map(Some)-}-fn signal_member<'s>(scope: &mut v8::PinScope<'s, '_>,object: v8::Local<'s, v8::Object>,