mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-29 06:02:07 +03:00
Browser: Set 'webdriver-active flag' when creating a new Tab
This commit is contained in:
parent
3f24a444f9
commit
5681115744
Notes:
sideshowbarker
2024-07-17 05:59:59 +09:00
Author: https://github.com/linusg Commit: https://github.com/SerenityOS/serenity/commit/5681115744 Pull-request: https://github.com/SerenityOS/serenity/pull/15559 Reviewed-by: https://github.com/ADKaster Reviewed-by: https://github.com/AtkinsSJ
@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
#include <AK/String.h>
|
#include <AK/String.h>
|
||||||
#include <Applications/Browser/IconBag.h>
|
#include <Applications/Browser/IconBag.h>
|
||||||
|
#include <Applications/Browser/WebDriverConnection.h>
|
||||||
|
|
||||||
namespace Browser {
|
namespace Browser {
|
||||||
|
|
||||||
@ -19,5 +20,6 @@ extern Vector<String> g_proxies;
|
|||||||
extern HashMap<String, size_t> g_proxy_mappings;
|
extern HashMap<String, size_t> g_proxy_mappings;
|
||||||
extern bool g_content_filters_enabled;
|
extern bool g_content_filters_enabled;
|
||||||
extern IconBag g_icon_bag;
|
extern IconBag g_icon_bag;
|
||||||
|
extern RefPtr<Browser::WebDriverConnection> g_web_driver_connection;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -127,6 +127,9 @@ Tab::Tab(BrowserWindow& window)
|
|||||||
|
|
||||||
m_web_content_view->set_proxy_mappings(g_proxies, g_proxy_mappings);
|
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());
|
auto& go_back_button = toolbar.add_action(window.go_back_action());
|
||||||
go_back_button.on_context_menu_request = [&](auto&) {
|
go_back_button.on_context_menu_request = [&](auto&) {
|
||||||
if (!m_history.can_go_back())
|
if (!m_history.can_go_back())
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
#include <LibGUI/TabWidget.h>
|
#include <LibGUI/TabWidget.h>
|
||||||
#include <LibMain/Main.h>
|
#include <LibMain/Main.h>
|
||||||
#include <LibWeb/Loader/ResourceLoader.h>
|
#include <LibWeb/Loader/ResourceLoader.h>
|
||||||
|
#include <LibWebView/OutOfProcessWebView.h>
|
||||||
#include <LibWebView/RequestServerAdapter.h>
|
#include <LibWebView/RequestServerAdapter.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
@ -39,6 +40,7 @@ bool g_content_filters_enabled { true };
|
|||||||
Vector<String> g_proxies;
|
Vector<String> g_proxies;
|
||||||
HashMap<String, size_t> g_proxy_mappings;
|
HashMap<String, size_t> g_proxy_mappings;
|
||||||
IconBag g_icon_bag;
|
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;
|
Browser::CookieJar cookie_jar;
|
||||||
auto window = Browser::BrowserWindow::construct(cookie_jar, first_url);
|
auto window = Browser::BrowserWindow::construct(cookie_jar, first_url);
|
||||||
RefPtr<Browser::WebDriverConnection> web_driver_connection;
|
|
||||||
|
|
||||||
if (!webdriver_ipc_path.is_empty())
|
if (!webdriver_ipc_path.is_empty()) {
|
||||||
web_driver_connection = TRY(Browser::WebDriverConnection::connect_to_webdriver(window, webdriver_ipc_path));
|
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());
|
auto content_filters_watcher = TRY(Core::FileWatcher::create());
|
||||||
content_filters_watcher->on_change = [&](Core::FileWatcherEvent const&) {
|
content_filters_watcher->on_change = [&](Core::FileWatcherEvent const&) {
|
||||||
|
Loading…
Reference in New Issue
Block a user