1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 13:17:35 +00:00

WebContent+WebDriver: Get window handle from WebContent process

This change makes window handles on WebDriver process side be
consistent with handles returned by /window/new.
This commit is contained in:
Aliaksandr Kalenik 2023-03-13 17:45:34 +03:00 committed by Tim Flynn
parent f287165823
commit 126fa7df14
5 changed files with 11 additions and 5 deletions

View file

@ -50,12 +50,11 @@ ErrorOr<NonnullRefPtr<Core::LocalServer>> Session::create_server(NonnullRefPtr<S
dbgln("WebDriver is connected to WebContent socket");
auto web_content_connection = maybe_connection.release_value();
auto handle_name = String::formatted("window-{}"sv, m_next_handle_id).release_value_but_fixme_should_propagate_errors();
m_next_handle_id++;
m_windows.set(handle_name, Session::Window { handle_name, move(web_content_connection) });
auto window_handle = web_content_connection->get_window_handle();
m_windows.set(window_handle, Session::Window { window_handle, move(web_content_connection) });
if (m_current_window_handle.is_empty())
m_current_window_handle = handle_name;
m_current_window_handle = window_handle;
MUST(promise->resolve({}));
};