summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
authorLinus Groh <mail@linusgroh.de>2022-10-12 23:51:37 +0200
committerAndreas Kling <kling@serenityos.org>2022-10-13 11:14:45 +0200
commit56811157446cbd79757245e26fc565842cd25fe9 (patch)
tree6c7efc272aa1c1d78242d9b4a4ab49c91013c4bc /Userland
parent3f24a444f9abe528f2fb0b4e7ab231bfda4db048 (diff)
downloadserenity-56811157446cbd79757245e26fc565842cd25fe9.zip
Browser: Set 'webdriver-active flag' when creating a new Tab
Diffstat (limited to 'Userland')
-rw-r--r--Userland/Applications/Browser/Browser.h2
-rw-r--r--Userland/Applications/Browser/Tab.cpp3
-rw-r--r--Userland/Applications/Browser/main.cpp12
3 files changed, 14 insertions, 3 deletions
diff --git a/Userland/Applications/Browser/Browser.h b/Userland/Applications/Browser/Browser.h
index 14d7e7d304..f637073014 100644
--- a/Userland/Applications/Browser/Browser.h
+++ b/Userland/Applications/Browser/Browser.h
@@ -8,6 +8,7 @@
#include <AK/String.h>
#include <Applications/Browser/IconBag.h>
+#include <Applications/Browser/WebDriverConnection.h>
namespace Browser {
@@ -19,5 +20,6 @@ extern Vector<String> g_proxies;
extern HashMap<String, size_t> g_proxy_mappings;
extern bool g_content_filters_enabled;
extern IconBag g_icon_bag;
+extern RefPtr<Browser::WebDriverConnection> g_web_driver_connection;
}
diff --git a/Userland/Applications/Browser/Tab.cpp b/Userland/Applications/Browser/Tab.cpp
index 33c7d73a1d..1306e1f0df 100644
--- a/Userland/Applications/Browser/Tab.cpp
+++ b/Userland/Applications/Browser/Tab.cpp
@@ -127,6 +127,9 @@ Tab::Tab(BrowserWindow& window)
m_web_content_view->set_proxy_mappings(g_proxies, g_proxy_mappings);
+ if (!g_web_driver_connection.is_null())
+ m_web_content_view->set_is_webdriver_active(true);
+
auto& go_back_button = toolbar.add_action(window.go_back_action());
go_back_button.on_context_menu_request = [&](auto&) {
if (!m_history.can_go_back())
diff --git a/Userland/Applications/Browser/main.cpp b/Userland/Applications/Browser/main.cpp
index f8d83a05b6..66f5d9a950 100644
--- a/Userland/Applications/Browser/main.cpp
+++ b/Userland/Applications/Browser/main.cpp
@@ -26,6 +26,7 @@
#include <LibGUI/TabWidget.h>
#include <LibMain/Main.h>
#include <LibWeb/Loader/ResourceLoader.h>
+#include <LibWebView/OutOfProcessWebView.h>
#include <LibWebView/RequestServerAdapter.h>
#include <unistd.h>
@@ -39,6 +40,7 @@ bool g_content_filters_enabled { true };
Vector<String> g_proxies;
HashMap<String, size_t> g_proxy_mappings;
IconBag g_icon_bag;
+RefPtr<Browser::WebDriverConnection> g_web_driver_connection;
}
@@ -144,10 +146,14 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
Browser::CookieJar cookie_jar;
auto window = Browser::BrowserWindow::construct(cookie_jar, first_url);
- RefPtr<Browser::WebDriverConnection> web_driver_connection;
- if (!webdriver_ipc_path.is_empty())
- web_driver_connection = TRY(Browser::WebDriverConnection::connect_to_webdriver(window, webdriver_ipc_path));
+ if (!webdriver_ipc_path.is_empty()) {
+ Browser::g_web_driver_connection = TRY(Browser::WebDriverConnection::connect_to_webdriver(window, webdriver_ipc_path));
+
+ // The first tab is created with the BrowserWindow above, so we have to do this
+ // manually once after establishing the connection.
+ window->active_tab().view().set_is_webdriver_active(true);
+ }
auto content_filters_watcher = TRY(Core::FileWatcher::create());
content_filters_watcher->on_change = [&](Core::FileWatcherEvent const&) {