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 <Kenzie.Raditya.Tirtarahardja@huawei.com>
This commit is contained in:
Kenzie Raditya Tirtarahardja 2025-07-15 14:52:35 +08:00 committed by GitHub
parent f155c95e1b
commit ccc902eb7a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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);
},