diff --git a/Userland/Services/WebContent/ConnectionFromClient.cpp b/Userland/Services/WebContent/ConnectionFromClient.cpp index f4ab796d124..6b0abf4cf13 100644 --- a/Userland/Services/WebContent/ConnectionFromClient.cpp +++ b/Userland/Services/WebContent/ConnectionFromClient.cpp @@ -74,8 +74,6 @@ void ConnectionFromClient::connect_to_webdriver(String const& webdriver_ipc_path // FIXME: Propogate this error back to the browser. if (auto result = m_page_host->connect_to_webdriver(webdriver_ipc_path); result.is_error()) dbgln("Unable to connect to the WebDriver process: {}", result.error()); - else - set_is_webdriver_active(true); } void ConnectionFromClient::update_system_theme(Core::AnonymousBuffer const& theme_buffer) @@ -801,11 +799,6 @@ void ConnectionFromClient::set_is_scripting_enabled(bool is_scripting_enabled) m_page_host->set_is_scripting_enabled(is_scripting_enabled); } -void ConnectionFromClient::set_is_webdriver_active(bool is_webdriver_active) -{ - m_page_host->set_is_webdriver_active(is_webdriver_active); -} - void ConnectionFromClient::set_window_position(Gfx::IntPoint const& position) { m_page_host->set_window_position(position); diff --git a/Userland/Services/WebContent/ConnectionFromClient.h b/Userland/Services/WebContent/ConnectionFromClient.h index d71afb00950..073f2f717f7 100644 --- a/Userland/Services/WebContent/ConnectionFromClient.h +++ b/Userland/Services/WebContent/ConnectionFromClient.h @@ -74,7 +74,6 @@ private: virtual void set_preferred_color_scheme(Web::CSS::PreferredColorScheme const&) override; virtual void set_has_focus(bool) override; virtual void set_is_scripting_enabled(bool) override; - virtual void set_is_webdriver_active(bool) override; virtual void set_window_position(Gfx::IntPoint const&) override; virtual void set_window_size(Gfx::IntSize const&) override; virtual void handle_file_return(i32 error, Optional const& file, i32 request_id) override; diff --git a/Userland/Services/WebContent/WebContentServer.ipc b/Userland/Services/WebContent/WebContentServer.ipc index 3e065edf690..03811421513 100644 --- a/Userland/Services/WebContent/WebContentServer.ipc +++ b/Userland/Services/WebContent/WebContentServer.ipc @@ -71,7 +71,6 @@ endpoint WebContentServer set_preferred_color_scheme(Web::CSS::PreferredColorScheme color_scheme) =| set_has_focus(bool has_focus) =| set_is_scripting_enabled(bool is_scripting_enabled) =| - set_is_webdriver_active(bool is_webdriver_active) =| set_window_position(Gfx::IntPoint position) =| set_window_size(Gfx::IntSize size) =| diff --git a/Userland/Services/WebContent/WebDriverClient.ipc b/Userland/Services/WebContent/WebDriverClient.ipc index 6c11180cf72..02292f5cf48 100644 --- a/Userland/Services/WebContent/WebDriverClient.ipc +++ b/Userland/Services/WebContent/WebDriverClient.ipc @@ -1,2 +1,3 @@ endpoint WebDriverClient { + set_is_webdriver_active(bool active) =| } diff --git a/Userland/Services/WebContent/WebDriverConnection.cpp b/Userland/Services/WebContent/WebDriverConnection.cpp index dbc42c471c6..4119ca716e0 100644 --- a/Userland/Services/WebContent/WebDriverConnection.cpp +++ b/Userland/Services/WebContent/WebDriverConnection.cpp @@ -34,4 +34,9 @@ WebDriverConnection::WebDriverConnection(NonnullOwnPtr socket, PageHost& page_host); virtual void die() override { } + virtual void set_is_webdriver_active(bool) override; PageHost& m_page_host; }; diff --git a/Userland/Services/WebDriver/Client.cpp b/Userland/Services/WebDriver/Client.cpp index 1a614f4919e..ad11fcb3bcb 100644 --- a/Userland/Services/WebDriver/Client.cpp +++ b/Userland/Services/WebDriver/Client.cpp @@ -385,6 +385,8 @@ Web::WebDriver::Response Client::handle_new_session(Vector const&, J return Web::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::SessionNotCreated, String::formatted("Failed to start session: {}", start_result.error().string_literal())); } + auto& web_content_connection = session->web_content_connection(); + // FIXME: 8. Set the current session to session. // FIXME: 9. Run any WebDriver new session algorithm defined in external specifications, @@ -405,7 +407,8 @@ Web::WebDriver::Response Client::handle_new_session(Vector const&, J // FIXME: 12. Initialize the following from capabilities: // NOTE: See spec for steps - // FIXME: 13. Set the webdriver-active flag to true. + // 13. Set the webdriver-active flag to true. + web_content_connection.async_set_is_webdriver_active(true); // FIXME: 14. Set the current top-level browsing context for session with the top-level browsing context // of the UA’s current browsing context. diff --git a/Userland/Services/WebDriver/Session.h b/Userland/Services/WebDriver/Session.h index 8e7885fdfde..e7d711d7f59 100644 --- a/Userland/Services/WebDriver/Session.h +++ b/Userland/Services/WebDriver/Session.h @@ -41,6 +41,12 @@ public: ErrorOr check_for_open_top_level_browsing_context_or_return_error(); String const& current_window_handle() { return m_current_window_handle; } + WebContentConnection& web_content_connection() + { + VERIFY(m_web_content_connection); + return *m_web_content_connection; + } + ErrorOr start(); ErrorOr stop(); JsonObject get_timeouts();