diff options
-rw-r--r-- | Userland/Services/WebContent/WebDriverClient.ipc | 1 | ||||
-rw-r--r-- | Userland/Services/WebContent/WebDriverConnection.cpp | 10 | ||||
-rw-r--r-- | Userland/Services/WebContent/WebDriverConnection.h | 1 | ||||
-rw-r--r-- | Userland/Services/WebDriver/Session.cpp | 5 |
4 files changed, 15 insertions, 2 deletions
diff --git a/Userland/Services/WebContent/WebDriverClient.ipc b/Userland/Services/WebContent/WebDriverClient.ipc index 3312c823f0..3a922d384d 100644 --- a/Userland/Services/WebContent/WebDriverClient.ipc +++ b/Userland/Services/WebContent/WebDriverClient.ipc @@ -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) diff --git a/Userland/Services/WebContent/WebDriverConnection.cpp b/Userland/Services/WebContent/WebDriverConnection.cpp index f95cece4cc..e0a7c707ea 100644 --- a/Userland/Services/WebContent/WebDriverConnection.cpp +++ b/Userland/Services/WebContent/WebDriverConnection.cpp @@ -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&) { diff --git a/Userland/Services/WebContent/WebDriverConnection.h b/Userland/Services/WebContent/WebDriverConnection.h index ef1dbe0869..0012ee301b 100644 --- a/Userland/Services/WebContent/WebDriverConnection.h +++ b/Userland/Services/WebContent/WebDriverConnection.h @@ -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; diff --git a/Userland/Services/WebDriver/Session.cpp b/Userland/Services/WebDriver/Session.cpp index 011d37d454..1af304d4bf 100644 --- a/Userland/Services/WebDriver/Session.cpp +++ b/Userland/Services/WebDriver/Session.cpp @@ -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 {}; |