mirror of
https://github.com/lexmount/moli.git
synced 2026-11-14 08:07:52 +00:00
refactor(protocol): share client window wire projection
Command output and the BiDi adapter duplicate client-window JSON projection. Export the existing protocol projection for the adapter to reuse, keeping ownership, enum conversion and all wire keys and values without adding a dependency cycle.
This commit is contained in:
@@ -370,17 +370,7 @@ fn bidi_realm_string_field<'a>(realm: &'a Value, field: &str) -> &'a str {
|
||||
realm.get(field).and_then(Value::as_str).unwrap_or("")
|
||||
}
|
||||
|
||||
fn bidi_client_window_info(window: moli_protocol::automation::DevToolsClientWindowInfo) -> Value {
|
||||
json!({
|
||||
"clientWindow": window.client_window.into_string(),
|
||||
"active": window.active,
|
||||
"state": window.state.as_bidi_value(),
|
||||
"width": window.width,
|
||||
"height": window.height,
|
||||
"x": window.x,
|
||||
"y": window.y,
|
||||
})
|
||||
}
|
||||
use moli_protocol::client_window_info_json as bidi_client_window_info;
|
||||
|
||||
fn bidi_user_contexts_from_browser_contexts(
|
||||
browser_context_ids: Vec<DevToolsBrowserContextId>,
|
||||
|
||||
@@ -1968,7 +1968,7 @@ fn service_worker_log_entry_json(entry: RuntimeConsoleEvent) -> Value {
|
||||
payload
|
||||
}
|
||||
|
||||
fn client_window_info_json(window: crate::automation::DevToolsClientWindowInfo) -> Value {
|
||||
pub fn client_window_info_json(window: crate::automation::DevToolsClientWindowInfo) -> Value {
|
||||
json!({
|
||||
"clientWindow": window.client_window.into_string(),
|
||||
"active": window.active,
|
||||
|
||||
@@ -12,6 +12,9 @@ pub mod domains;
|
||||
pub mod frame_index;
|
||||
#[cfg(feature = "test-support")]
|
||||
pub mod test_support;
|
||||
|
||||
pub use domains::command_output::client_window_info_json;
|
||||
|
||||
#[cfg(test)]
|
||||
pub mod testing;
|
||||
pub mod version;
|
||||
|
||||
Reference in New Issue
Block a user