1
0
Fork 0
mirror of https://github.com/LadybirdBrowser/ladybird.git synced 2025-06-11 10:18:15 +09:00

WebDriver: Activate the browser tab during the Switch To Window command

This commit is contained in:
Timothy Flynn 2023-03-20 19:53:15 -04:00 committed by Linus Groh
parent f8b6369c23
commit a96ba912b3
Notes: sideshowbarker 2024-07-17 07:25:39 +09:00
4 changed files with 15 additions and 2 deletions

View file

@ -17,6 +17,7 @@ endpoint WebDriverClient {
get_title() => (Web::WebDriver::Response response)
get_window_handle() => (String handle)
close_window() => (Web::WebDriver::Response response)
switch_to_window() => (Web::WebDriver::Response response)
new_window(JsonValue payload) => (Web::WebDriver::Response response)
get_window_rect() => (Web::WebDriver::Response response)
set_window_rect(JsonValue payload) => (Web::WebDriver::Response response)

View file

@ -545,6 +545,16 @@ Messages::WebDriverClient::CloseWindowResponse WebDriverConnection::close_window
return JsonValue {};
}
// 11.3 Switch to Window, https://w3c.github.io/webdriver/#dfn-switch-to-window
Messages::WebDriverClient::SwitchToWindowResponse WebDriverConnection::switch_to_window()
{
// 5. Update any implementation-specific state that would result from the user selecting the current
// browsing context for interaction, without altering OS-level focus.
m_page_client.page_did_request_activate_tab();
return JsonValue {};
}
// 11.5 New Window, https://w3c.github.io/webdriver/#dfn-new-window
Messages::WebDriverClient::NewWindowResponse WebDriverConnection::new_window(JsonValue const&)
{

View file

@ -54,6 +54,7 @@ private:
virtual Messages::WebDriverClient::GetTitleResponse get_title() override;
virtual Messages::WebDriverClient::GetWindowHandleResponse get_window_handle() override;
virtual Messages::WebDriverClient::CloseWindowResponse close_window() override;
virtual Messages::WebDriverClient::SwitchToWindowResponse switch_to_window() override;
virtual Messages::WebDriverClient::NewWindowResponse new_window(JsonValue const& payload) override;
virtual Messages::WebDriverClient::GetWindowRectResponse get_window_rect() override;
virtual Messages::WebDriverClient::SetWindowRectResponse set_window_rect(JsonValue const& payload) override;

View file

@ -144,8 +144,9 @@ Web::WebDriver::Response Session::switch_to_window(StringView handle)
else
return Web::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::NoSuchWindow, "Window not found");
// FIXME: 5. Update any implementation-specific state that would result from the user selecting the current
// browsing context for interaction, without altering OS-level focus.
// 5. Update any implementation-specific state that would result from the user selecting the current
// browsing context for interaction, without altering OS-level focus.
TRY(web_content_connection().switch_to_window());
// 6. Return success with data null.
return JsonValue {};