1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 19:47:44 +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:
Timothy Flynn 2022-11-08 14:14:29 -05:00 committed by Tim Flynn
parent 3ba6b5a7cb
commit cc78a74c51
7 changed files with 47 additions and 8 deletions

View file

@ -136,10 +136,23 @@ ErrorOr<void> Session::start()
return {};
}
ErrorOr<void> Session::stop()
// https://w3c.github.io/webdriver/#dfn-close-the-session
Web::WebDriver::Response Session::stop()
{
// 1. Perform the following substeps based on the remote ends type:
// NOTE: We perform the "Remote end is an endpoint node" steps in the WebContent process.
m_web_content_connection->close_session();
m_web_content_connection = nullptr;
// 2. Remove the current session from active sessions.
// NOTE: Handled by WebDriver::Client.
// 3. Perform any implementation-specific cleanup steps.
m_browser_connection->async_quit();
return {};
m_started = false;
// 4. If an error has occurred in any of the steps above, return the error, otherwise return success with data null.
return JsonValue {};
}
// 9.1 Get Timeouts, https://w3c.github.io/webdriver/#dfn-get-timeouts