mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 12:27:36 +00:00
WebContent+WebDriver: Fully implement closing a session
There were a couple steps missing to close the remote end. Further, we were not removing the session from the list of active sessions.
This commit is contained in:
parent
3ba6b5a7cb
commit
cc78a74c51
7 changed files with 47 additions and 8 deletions
|
@ -1,6 +1,7 @@
|
|||
#include <LibWeb/WebDriver/Response.h>
|
||||
|
||||
endpoint WebDriverClient {
|
||||
close_session() => ()
|
||||
set_is_webdriver_active(bool active) =|
|
||||
navigate_to(JsonValue payload) => (Web::WebDriver::Response response)
|
||||
get_current_url() => (Web::WebDriver::Response response)
|
||||
|
|
|
@ -50,6 +50,16 @@ WebDriverConnection::WebDriverConnection(NonnullOwnPtr<Core::Stream::LocalSocket
|
|||
{
|
||||
}
|
||||
|
||||
// https://w3c.github.io/webdriver/#dfn-close-the-session
|
||||
void WebDriverConnection::close_session()
|
||||
{
|
||||
// 1. Set the webdriver-active flag to false.
|
||||
set_is_webdriver_active(false);
|
||||
|
||||
// 2. An endpoint node must close any top-level browsing contexts associated with the session, without prompting to unload.
|
||||
m_page_host.page().top_level_browsing_context().close();
|
||||
}
|
||||
|
||||
void WebDriverConnection::set_is_webdriver_active(bool is_webdriver_active)
|
||||
{
|
||||
m_page_host.set_is_webdriver_active(is_webdriver_active);
|
||||
|
|
|
@ -28,6 +28,8 @@ private:
|
|||
WebDriverConnection(NonnullOwnPtr<Core::Stream::LocalSocket> socket, PageHost& page_host);
|
||||
|
||||
virtual void die() override { }
|
||||
|
||||
virtual void close_session() override;
|
||||
virtual void set_is_webdriver_active(bool) override;
|
||||
virtual Messages::WebDriverClient::NavigateToResponse navigate_to(JsonValue const& payload) override;
|
||||
virtual Messages::WebDriverClient::GetCurrentUrlResponse get_current_url() override;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue