From 6d91d2fa507b5c698d893abed622ab61a1a2b1c6 Mon Sep 17 00:00:00 2001 From: Aliaksandr Kalenik Date: Thu, 16 Mar 2023 17:36:36 +0300 Subject: [PATCH] WebContent: Add IPC call to set window handle from WebContent client --- Userland/Libraries/LibWeb/HTML/BrowsingContext.h | 1 + Userland/Services/WebContent/ConnectionFromClient.cpp | 5 +++++ Userland/Services/WebContent/ConnectionFromClient.h | 1 + Userland/Services/WebContent/WebContentServer.ipc | 1 + 4 files changed, 8 insertions(+) diff --git a/Userland/Libraries/LibWeb/HTML/BrowsingContext.h b/Userland/Libraries/LibWeb/HTML/BrowsingContext.h index bdb6fe725f..ffab00398a 100644 --- a/Userland/Libraries/LibWeb/HTML/BrowsingContext.h +++ b/Userland/Libraries/LibWeb/HTML/BrowsingContext.h @@ -268,6 +268,7 @@ public: Optional const& creator_url() const { return m_creator_url; } String const& window_handle() const { return m_window_handle; } + void set_window_handle(String handle) { m_window_handle = move(handle); } private: explicit BrowsingContext(Page&, HTML::BrowsingContextContainer*); diff --git a/Userland/Services/WebContent/ConnectionFromClient.cpp b/Userland/Services/WebContent/ConnectionFromClient.cpp index e321205b7b..a39e99a3d9 100644 --- a/Userland/Services/WebContent/ConnectionFromClient.cpp +++ b/Userland/Services/WebContent/ConnectionFromClient.cpp @@ -66,6 +66,11 @@ Messages::WebContentServer::GetWindowHandleResponse ConnectionFromClient::get_wi return m_page_host->page().top_level_browsing_context().window_handle(); } +void ConnectionFromClient::set_window_handle(String const& handle) +{ + m_page_host->page().top_level_browsing_context().set_window_handle(handle); +} + void ConnectionFromClient::connect_to_webdriver(DeprecatedString const& webdriver_ipc_path) { // FIXME: Propagate this error back to the browser. diff --git a/Userland/Services/WebContent/ConnectionFromClient.h b/Userland/Services/WebContent/ConnectionFromClient.h index e9124dd3ee..57d5c92404 100644 --- a/Userland/Services/WebContent/ConnectionFromClient.h +++ b/Userland/Services/WebContent/ConnectionFromClient.h @@ -49,6 +49,7 @@ private: Web::Page const& page() const; virtual Messages::WebContentServer::GetWindowHandleResponse get_window_handle() override; + virtual void set_window_handle(String const& handle) override; virtual void connect_to_webdriver(DeprecatedString const& webdriver_ipc_path) override; virtual void update_system_theme(Core::AnonymousBuffer const&) override; virtual void update_system_fonts(DeprecatedString const&, DeprecatedString const&, DeprecatedString const&) override; diff --git a/Userland/Services/WebContent/WebContentServer.ipc b/Userland/Services/WebContent/WebContentServer.ipc index 85cf2aead5..a6b534b973 100644 --- a/Userland/Services/WebContent/WebContentServer.ipc +++ b/Userland/Services/WebContent/WebContentServer.ipc @@ -10,6 +10,7 @@ endpoint WebContentServer { get_window_handle() => (String handle) + set_window_handle(String handle) =| connect_to_webdriver(DeprecatedString webdriver_ipc_path) =|