diff options
author | Aliaksandr Kalenik <kalenik.aliaksandr@gmail.com> | 2023-03-13 17:45:34 +0300 |
---|---|---|
committer | Tim Flynn <trflynn89@pm.me> | 2023-03-16 13:17:37 -0400 |
commit | 126fa7df14e865ef00f5beb9aeac8c7d0dc5b20d (patch) | |
tree | 5c63b829074fcb6a58b6f9b39f6ce1b2b52dc7d4 /Userland/Services/WebContent | |
parent | f28716582369cd7e79c3df7196278990d45492b7 (diff) | |
download | serenity-126fa7df14e865ef00f5beb9aeac8c7d0dc5b20d.zip |
WebContent+WebDriver: Get window handle from WebContent process
This change makes window handles on WebDriver process side be
consistent with handles returned by /window/new.
Diffstat (limited to 'Userland/Services/WebContent')
-rw-r--r-- | Userland/Services/WebContent/WebDriverClient.ipc | 1 | ||||
-rw-r--r-- | Userland/Services/WebContent/WebDriverConnection.cpp | 6 | ||||
-rw-r--r-- | Userland/Services/WebContent/WebDriverConnection.h | 1 |
3 files changed, 8 insertions, 0 deletions
diff --git a/Userland/Services/WebContent/WebDriverClient.ipc b/Userland/Services/WebContent/WebDriverClient.ipc index 3ae9553102..3312c823f0 100644 --- a/Userland/Services/WebContent/WebDriverClient.ipc +++ b/Userland/Services/WebContent/WebDriverClient.ipc @@ -15,6 +15,7 @@ endpoint WebDriverClient { forward() => (Web::WebDriver::Response response) refresh() => (Web::WebDriver::Response response) get_title() => (Web::WebDriver::Response response) + get_window_handle() => (String handle) close_window() => (Web::WebDriver::Response response) new_window(JsonValue payload) => (Web::WebDriver::Response response) get_window_rect() => (Web::WebDriver::Response response) diff --git a/Userland/Services/WebContent/WebDriverConnection.cpp b/Userland/Services/WebContent/WebDriverConnection.cpp index bd157d4f70..74da18d6b5 100644 --- a/Userland/Services/WebContent/WebDriverConnection.cpp +++ b/Userland/Services/WebContent/WebDriverConnection.cpp @@ -522,6 +522,12 @@ Messages::WebDriverClient::GetTitleResponse WebDriverConnection::get_title() return title; } +// 11.1 Get Window Handle, https://w3c.github.io/webdriver/#get-window-handle +Messages::WebDriverClient::GetWindowHandleResponse WebDriverConnection::get_window_handle() +{ + return m_page_client.page().top_level_browsing_context().window_handle(); +} + // 11.2 Close Window, https://w3c.github.io/webdriver/#dfn-close-window Messages::WebDriverClient::CloseWindowResponse WebDriverConnection::close_window() { diff --git a/Userland/Services/WebContent/WebDriverConnection.h b/Userland/Services/WebContent/WebDriverConnection.h index e1bfcf2aad..ef1dbe0869 100644 --- a/Userland/Services/WebContent/WebDriverConnection.h +++ b/Userland/Services/WebContent/WebDriverConnection.h @@ -52,6 +52,7 @@ private: virtual Messages::WebDriverClient::ForwardResponse forward() override; virtual Messages::WebDriverClient::RefreshResponse refresh() override; 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::NewWindowResponse new_window(JsonValue const& payload) override; virtual Messages::WebDriverClient::GetWindowRectResponse get_window_rect() override; |