diff options
author | Timothy Flynn <trflynn89@pm.me> | 2023-03-07 11:29:14 -0500 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2023-03-07 18:16:35 +0000 |
commit | 0524bc1d13d8dfc504f66f3a4abf92cbab9bb21a (patch) | |
tree | e81b622f3f6f50f01d0eb3b53429e84aff452b30 /Userland/Services/WebContent | |
parent | 010be9b7c26b2d28da539965acc66797f99dd356 (diff) | |
download | serenity-0524bc1d13d8dfc504f66f3a4abf92cbab9bb21a.zip |
WebContent+WebDriver: Ensure Get Window Handle checks for closed BCs
Diffstat (limited to 'Userland/Services/WebContent')
-rw-r--r-- | Userland/Services/WebContent/WebDriverClient.ipc | 1 | ||||
-rw-r--r-- | Userland/Services/WebContent/WebDriverConnection.cpp | 9 | ||||
-rw-r--r-- | Userland/Services/WebContent/WebDriverConnection.h | 2 |
3 files changed, 11 insertions, 1 deletions
diff --git a/Userland/Services/WebContent/WebDriverClient.ipc b/Userland/Services/WebContent/WebDriverClient.ipc index 28e3ac0096..035e37d714 100644 --- a/Userland/Services/WebContent/WebDriverClient.ipc +++ b/Userland/Services/WebContent/WebDriverClient.ipc @@ -55,4 +55,5 @@ endpoint WebDriverClient { take_screenshot() => (Web::WebDriver::Response response) take_element_screenshot(String element_id) => (Web::WebDriver::Response response) print_page() => (Web::WebDriver::Response response) + ensure_top_level_browsing_context_is_open() => (Web::WebDriver::Response response) } diff --git a/Userland/Services/WebContent/WebDriverConnection.cpp b/Userland/Services/WebContent/WebDriverConnection.cpp index ae62835614..e3a524a341 100644 --- a/Userland/Services/WebContent/WebDriverConnection.cpp +++ b/Userland/Services/WebContent/WebDriverConnection.cpp @@ -1745,11 +1745,18 @@ Messages::WebDriverClient::PrintPageResponse WebDriverConnection::print_page() } // https://w3c.github.io/webdriver/#dfn-no-longer-open -ErrorOr<void, Web::WebDriver::Error> WebDriverConnection::ensure_open_top_level_browsing_context() +Messages::WebDriverClient::EnsureTopLevelBrowsingContextIsOpenResponse WebDriverConnection::ensure_top_level_browsing_context_is_open() { // A browsing context is said to be no longer open if it has been discarded. if (m_page_client.page().top_level_browsing_context().has_been_discarded()) return Web::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::NoSuchWindow, "Window not found"sv); + return JsonValue {}; +} + +// https://w3c.github.io/webdriver/#dfn-no-longer-open +ErrorOr<void, Web::WebDriver::Error> WebDriverConnection::ensure_open_top_level_browsing_context() +{ + TRY(ensure_top_level_browsing_context_is_open().take_response()); return {}; } diff --git a/Userland/Services/WebContent/WebDriverConnection.h b/Userland/Services/WebContent/WebDriverConnection.h index 7b64828fbb..9e269d1307 100644 --- a/Userland/Services/WebContent/WebDriverConnection.h +++ b/Userland/Services/WebContent/WebDriverConnection.h @@ -93,7 +93,9 @@ private: virtual Messages::WebDriverClient::TakeElementScreenshotResponse take_element_screenshot(String const& element_id) override; virtual Messages::WebDriverClient::PrintPageResponse print_page() override; + virtual Messages::WebDriverClient::EnsureTopLevelBrowsingContextIsOpenResponse ensure_top_level_browsing_context_is_open() override; ErrorOr<void, Web::WebDriver::Error> ensure_open_top_level_browsing_context(); + ErrorOr<void, Web::WebDriver::Error> handle_any_user_prompts(); void restore_the_window(); Gfx::IntRect maximize_the_window(); |