mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-09 17:49:40 +00:00
WebDriver: Move session management to the Session class
Session management is a bit awkward right now in that the list of active sessions is managed by Client, resulting in operations like closing a session being split between several functions in Client and Session. This patch moves all session management to the Session class. Closing a session is now entirely in Session::close(). This will make managing a separate HTTP session list a bit simpler.
This commit is contained in:
parent
0c882c441e
commit
d95be7d88c
Notes:
github-actions[bot]
2025-02-10 16:35:24 +00:00
Author: https://github.com/trflynn89
Commit: d95be7d88c
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3497
4 changed files with 126 additions and 151 deletions
|
@ -11,10 +11,9 @@
|
|||
#include <AK/Function.h>
|
||||
#include <AK/NonnullRefPtr.h>
|
||||
#include <LibCore/EventReceiver.h>
|
||||
#include <LibCore/Process.h>
|
||||
#include <LibWeb/WebDriver/Client.h>
|
||||
#include <LibWeb/WebDriver/Error.h>
|
||||
#include <LibWeb/WebDriver/Response.h>
|
||||
#include <WebDriver/Session.h>
|
||||
|
||||
namespace WebDriver {
|
||||
|
||||
|
@ -31,17 +30,10 @@ public:
|
|||
virtual ~Client() override;
|
||||
|
||||
LaunchBrowserCallbacks const& launch_browser_callbacks() const { return m_callbacks; }
|
||||
void close_session(String const& session_id);
|
||||
|
||||
private:
|
||||
Client(NonnullOwnPtr<Core::BufferedTCPSocket>, LaunchBrowserCallbacks, Core::EventReceiver* parent);
|
||||
|
||||
enum class AllowInvalidWindowHandle {
|
||||
No,
|
||||
Yes,
|
||||
};
|
||||
ErrorOr<NonnullRefPtr<Session>, Web::WebDriver::Error> find_session_with_id(StringView session_id, AllowInvalidWindowHandle = AllowInvalidWindowHandle::No);
|
||||
|
||||
virtual Web::WebDriver::Response new_session(Web::WebDriver::Parameters parameters, JsonValue payload) override;
|
||||
virtual Web::WebDriver::Response delete_session(Web::WebDriver::Parameters parameters, JsonValue payload) override;
|
||||
virtual Web::WebDriver::Response get_status(Web::WebDriver::Parameters parameters, JsonValue payload) override;
|
||||
|
@ -105,8 +97,6 @@ private:
|
|||
virtual Web::WebDriver::Response take_element_screenshot(Web::WebDriver::Parameters parameters, JsonValue payload) override;
|
||||
virtual Web::WebDriver::Response print_page(Web::WebDriver::Parameters parameters, JsonValue payload) override;
|
||||
|
||||
static HashMap<String, NonnullRefPtr<Session>> s_sessions;
|
||||
|
||||
LaunchBrowserCallbacks m_callbacks;
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue