mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-29 04:09:13 +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
|
@ -32,7 +32,11 @@ public:
|
|||
static ErrorOr<NonnullRefPtr<Session>> create(NonnullRefPtr<Client> client, JsonObject& capabilities, ReadonlySpan<StringView> flags);
|
||||
~Session();
|
||||
|
||||
String session_id() const { return m_id; }
|
||||
enum class AllowInvalidWindowHandle {
|
||||
No,
|
||||
Yes,
|
||||
};
|
||||
static ErrorOr<NonnullRefPtr<Session>, Web::WebDriver::Error> find_session(StringView session_id, AllowInvalidWindowHandle = AllowInvalidWindowHandle::No);
|
||||
|
||||
struct Window {
|
||||
String handle;
|
||||
|
@ -47,10 +51,10 @@ public:
|
|||
return current_window->web_content_connection;
|
||||
}
|
||||
|
||||
String const& current_window_handle() const
|
||||
{
|
||||
return m_current_window_handle;
|
||||
}
|
||||
void close();
|
||||
|
||||
String session_id() const { return m_session_id; }
|
||||
String const& current_window_handle() const { return m_current_window_handle; }
|
||||
|
||||
bool has_window_handle(StringView handle) const { return m_windows.contains(handle); }
|
||||
|
||||
|
@ -89,9 +93,7 @@ private:
|
|||
NonnullRefPtr<Client> m_client;
|
||||
Web::WebDriver::LadybirdOptions m_options;
|
||||
|
||||
bool m_started { false };
|
||||
|
||||
String m_id;
|
||||
String m_session_id;
|
||||
bool m_http { false };
|
||||
|
||||
HashMap<String, Window> m_windows;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue