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): consolidate peer connection configuration declarations

ldm0dab843fff275
diff --git a/moli-renderer-v8/src/context_bootstrap/webrtc.rs b/moli-renderer-v8/src/context_bootstrap/webrtc.rs
index 4c6635cb0..c5523d38a 100644
--- a/moli-renderer-v8/src/context_bootstrap/webrtc.rs
+++ b/moli-renderer-v8/src/context_bootstrap/webrtc.rs
@@ -150,6 +150,10 @@ struct RtcPeerConnectionPrototypeDeclaration {
#[webapi(accessor_property = "pendingLocalDescription", getter = rtc_peer_connection_description_getter, data = callback_data_index_value(scope, 2))]
pending_local_description: (),
+ #[webapi(method, length = 0, callback = configuration::get_configuration, receiver = web_api_interfaces::RTCPeerConnection::is_instance)]
+ get_configuration: (),
+ #[webapi(method, length = 0, callback = configuration::set_configuration, receiver = web_api_interfaces::RTCPeerConnection::is_instance)]
+ set_configuration: (),
#[webapi(method = "createDataChannel", length = 1, callback = rtc_peer_connection_create_data_channel_callback)]
create_data_channel: (),
#[webapi(method = "createOffer", length = 0, callback = rtc_peer_connection_create_offer_callback)]
@@ -215,7 +219,6 @@ pub(in crate::context_bootstrap) fn install_webrtc_template_bindings<'s>(
}
"RTCPeerConnection" => {
RtcPeerConnectionPrototypeDeclaration::initialize_prototype_template(scope, prototype);
- configuration::install(scope, prototype);
}
"RTCErrorEvent" => events::install_event_template_bindings(scope, template, interface_name),
"RTCRtpReceiver" => {
diff --git a/moli-renderer-v8/src/context_bootstrap/webrtc/configuration.rs b/moli-renderer-v8/src/context_bootstrap/webrtc/configuration.rs
index ec7e21651..f7bca4c65 100644
--- a/moli-renderer-v8/src/context_bootstrap/webrtc/configuration.rs
+++ b/moli-renderer-v8/src/context_bootstrap/webrtc/configuration.rs
@@ -9,7 +9,7 @@ use crate::{
util::{get_private_value, new_null_prototype_object, set_private_value, v8str},
web_api_interfaces, webidl,
};
-use moli_webapi_declare::{WebApiFunctionTemplate, WebApiObject, WebApiValue};
+use moli_webapi_declare::{WebApiObject, WebApiValue};
#[derive(Clone, Copy, webidl::WebIdlEnum)]
#[webidl(name = "RTCBundlePolicy")]
@@ -187,22 +187,6 @@ struct ConfigurationArgs<'s> {
configuration: Configuration<'s>,
}
-#[derive(WebApiFunctionTemplate)]
-#[webapi(interface = web_api_interfaces::RTCPeerConnection, enumerable, receiver)]
-struct ConfigurationPrototype {
- #[webapi(method, length = 0, callback = get_configuration)]
- get_configuration: (),
- #[webapi(method, length = 0, callback = set_configuration)]
- set_configuration: (),
-}
-
-pub(super) fn install<'s>(
- scope: &mut v8::PinScope<'s, '_, ()>,
- prototype: v8::Local<'s, v8::ObjectTemplate>,
-) {
- ConfigurationPrototype::initialize_prototype_template(scope, prototype);
-}
-
pub(super) fn constructor_configuration<'s>(
scope: &mut v8::PinScope<'s, '_>,
args: &v8::FunctionCallbackArguments<'s>,
@@ -233,7 +217,7 @@ fn configuration<'s>(
.expect("native RTCConfiguration snapshot")
}
-fn get_configuration<'s>(
+pub(super) fn get_configuration<'s>(
scope: &mut v8::PinScope<'s, '_>,
args: v8::FunctionCallbackArguments<'s>,
mut rv: v8::ReturnValue<'_, v8::Value>,
@@ -243,7 +227,7 @@ fn get_configuration<'s>(
rv.set(copy_configuration(scope, stored, false).into());
}
-fn set_configuration<'s>(
+pub(super) fn set_configuration<'s>(
scope: &mut v8::PinScope<'s, '_>,
args: v8::FunctionCallbackArguments<'s>,
_rv: v8::ReturnValue<'_, v8::Value>,