summaryrefslogtreecommitdiff
path: root/Userland/Services/WebContent
diff options
context:
space:
mode:
authorTimothy Flynn <trflynn89@pm.me>2023-03-20 19:53:15 -0400
committerLinus Groh <mail@linusgroh.de>2023-03-21 09:39:49 +0000
commita96ba912b38d2e30b927e36d8ca6850a395f9529 (patch)
tree3e979c128b2e020a9eedac4c5a14093bb5f1b212 /Userland/Services/WebContent
parentf8b6369c238a57abb2fb3f5b093c5b629070e1f4 (diff)
downloadserenity-a96ba912b38d2e30b927e36d8ca6850a395f9529.zip
WebDriver: Activate the browser tab during the Switch To Window command
Diffstat (limited to 'Userland/Services/WebContent')
-rw-r--r--Userland/Services/WebContent/WebDriverClient.ipc1
-rw-r--r--Userland/Services/WebContent/WebDriverConnection.cpp10
-rw-r--r--Userland/Services/WebContent/WebDriverConnection.h1
3 files changed, 12 insertions, 0 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;