WebDriver: Access global sessions mutably when finding sessions

We grab RefPtr to non-const for the sessions within, so we can't call
const get() on the global maps. That would return a const reference.
This commit is contained in:
Andrew Kaster 2025-04-15 16:04:06 -06:00
parent 4d828378d8
commit 1819404e43

View file

@ -130,7 +130,7 @@ Session::~Session() = default;
ErrorOr<NonnullRefPtr<Session>, Web::WebDriver::Error> Session::find_session(StringView session_id, Web::WebDriver::SessionFlags session_flags, AllowInvalidWindowHandle allow_invalid_window_handle)
{
auto const& sessions = has_flag(session_flags, Web::WebDriver::SessionFlags::Http) ? s_http_sessions : s_sessions;
auto& sessions = has_flag(session_flags, Web::WebDriver::SessionFlags::Http) ? s_http_sessions : s_sessions;
if (auto session = sessions.get(session_id); session.has_value()) {
if (allow_invalid_window_handle == AllowInvalidWindowHandle::No)