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

Browser: Set 'webdriver-active flag' when creating a new Tab

This commit is contained in:
Linus Groh 2022-10-12 23:51:37 +02:00 committed by Andreas Kling
parent 3f24a444f9
commit 5681115744
3 changed files with 14 additions and 3 deletions

View file

@ -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&) {