From ccc902eb7aedbf225f97530b9315587972aa6213 Mon Sep 17 00:00:00 2001 From: Kenzie Raditya Tirtarahardja Date: Tue, 15 Jul 2025 14:52:35 +0800 Subject: [PATCH] Chore: Merge all moved webdriver command msg in constellation (#38081) Small clean up to shortened the code length and making it more neat. Signed-off-by: PotatoCP --- components/constellation/constellation.rs | 58 +++++++---------------- 1 file changed, 16 insertions(+), 42 deletions(-) diff --git a/components/constellation/constellation.rs b/components/constellation/constellation.rs index c9f93d9ab11..fb5022a925e 100644 --- a/components/constellation/constellation.rs +++ b/components/constellation/constellation.rs @@ -4552,37 +4552,10 @@ where // Find the script channel for the given parent pipeline, // and pass the event to that script thread. match msg { - WebDriverCommandMsg::CloseWebView(..) => { - unreachable!("This command should be send directly to the embedder."); - }, - WebDriverCommandMsg::NewWebView(..) => { - unreachable!("This command should be send directly to the embedder."); - }, - WebDriverCommandMsg::FocusWebView(..) => { - unreachable!("This command should be send directly to the embedder."); - }, - WebDriverCommandMsg::IsWebViewOpen(..) => { - unreachable!("This command should be send directly to the embedder."); - }, WebDriverCommandMsg::IsBrowsingContextOpen(browsing_context_id, response_sender) => { let is_open = self.browsing_contexts.contains_key(&browsing_context_id); let _ = response_sender.send(is_open); }, - WebDriverCommandMsg::GetWindowRect(..) => { - unreachable!("This command should be send directly to the embedder."); - }, - WebDriverCommandMsg::GetViewportSize(..) => { - unreachable!("This command should be send directly to the embedder."); - }, - WebDriverCommandMsg::SetWindowSize(..) => { - unreachable!("This command should be send directly to the embedder."); - }, - WebDriverCommandMsg::LoadUrl(..) => { - unreachable!("This command should be send directly to the embedder."); - }, - WebDriverCommandMsg::Refresh(..) => { - unreachable!("This command should be send directly to the embedder."); - }, // TODO: This should use the ScriptThreadMessage::EvaluateJavaScript command WebDriverCommandMsg::ScriptCommand(browsing_context_id, cmd) => { let pipeline_id = self @@ -4599,21 +4572,6 @@ where self.handle_send_error(pipeline_id, e); } }, - WebDriverCommandMsg::SendKeys(..) => { - unreachable!("This command should be send directly to the embedder."); - }, - WebDriverCommandMsg::KeyboardAction(..) => { - unreachable!("This command should be send directly to the embedder."); - }, - WebDriverCommandMsg::MouseButtonAction(..) => { - unreachable!("This command should be send directly to the embedder."); - }, - WebDriverCommandMsg::MouseMoveAction(..) => { - unreachable!("This command should be send directly to the embedder."); - }, - WebDriverCommandMsg::WheelScrollAction(..) => { - unreachable!("This command should be send directly to the embedder."); - }, WebDriverCommandMsg::TakeScreenshot(webview_id, rect, response_sender) => { self.compositor_proxy.send(CompositorMsg::CreatePng( webview_id, @@ -4621,6 +4579,22 @@ where response_sender, )); }, + WebDriverCommandMsg::CloseWebView(..) | + WebDriverCommandMsg::NewWebView(..) | + WebDriverCommandMsg::FocusWebView(..) | + WebDriverCommandMsg::IsWebViewOpen(..) | + WebDriverCommandMsg::GetWindowRect(..) | + WebDriverCommandMsg::GetViewportSize(..) | + WebDriverCommandMsg::SetWindowSize(..) | + WebDriverCommandMsg::LoadUrl(..) | + WebDriverCommandMsg::Refresh(..) | + WebDriverCommandMsg::SendKeys(..) | + WebDriverCommandMsg::KeyboardAction(..) | + WebDriverCommandMsg::MouseButtonAction(..) | + WebDriverCommandMsg::MouseMoveAction(..) | + WebDriverCommandMsg::WheelScrollAction(..) => { + unreachable!("This command should be send directly to the embedder."); + }, _ => { warn!("Unhandled WebDriver command: {:?}", msg); },