diff --git a/Userland/Services/WebContent/PageClient.cpp b/Userland/Services/WebContent/PageClient.cpp index ff9b135df92..fbaea0d2783 100644 --- a/Userland/Services/WebContent/PageClient.cpp +++ b/Userland/Services/WebContent/PageClient.cpp @@ -538,6 +538,9 @@ void PageClient::page_did_close_top_level_traversable() // FIXME: Rename this IPC call client().async_did_close_browsing_context(m_id); + if (m_webdriver) + m_webdriver->async_window_closed(); + // NOTE: This only removes the strong reference the PageHost has for this PageClient. // It will be GC'd 'later'. m_owner.remove_page({}, m_id); diff --git a/Userland/Services/WebContent/WebDriverServer.ipc b/Userland/Services/WebContent/WebDriverServer.ipc index 753461970b4..e1054890787 100644 --- a/Userland/Services/WebContent/WebDriverServer.ipc +++ b/Userland/Services/WebContent/WebDriverServer.ipc @@ -1,6 +1,7 @@ #include endpoint WebDriverServer { + window_closed() =| script_executed(Web::WebDriver::Response response) =| actions_performed(Web::WebDriver::Response response) =| } diff --git a/Userland/Services/WebDriver/WebContentConnection.cpp b/Userland/Services/WebDriver/WebContentConnection.cpp index 2d84edcc2d0..ba6c4af84e5 100644 --- a/Userland/Services/WebDriver/WebContentConnection.cpp +++ b/Userland/Services/WebDriver/WebContentConnection.cpp @@ -20,6 +20,11 @@ void WebContentConnection::die() on_close(); } +void WebContentConnection::window_closed() +{ + shutdown(); +} + void WebContentConnection::script_executed(Web::WebDriver::Response const& response) { if (on_script_executed) diff --git a/Userland/Services/WebDriver/WebContentConnection.h b/Userland/Services/WebDriver/WebContentConnection.h index 01b4b201fb0..a0eb4dde61f 100644 --- a/Userland/Services/WebDriver/WebContentConnection.h +++ b/Userland/Services/WebDriver/WebContentConnection.h @@ -27,6 +27,7 @@ public: private: virtual void die() override; + virtual void window_closed() override; virtual void script_executed(Web::WebDriver::Response const&) override; virtual void actions_performed(Web::WebDriver::Response const&) override; };