1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-18 21:35:06 +00:00

WebContent+LibWebView: Consolidate the way browsers connect to WebDriver

Currently, on Serenity, we connect to WebDriver from the browser-side of
the WebContent connection for both Browser and headless-browser.

On Lagom, we connect from within the WebContent process itself, signaled
by a command line flag.

This patch changes Lagom browsers to connect to WebDriver the same way
that Serenity browsers do. This will ensure we can do other initializers
in the same order across all platforms and browsers.
This commit is contained in:
Timothy Flynn 2023-03-16 08:50:22 -04:00 committed by Linus Groh
parent 3a7257c9fe
commit 700ad6bf35
7 changed files with 19 additions and 20 deletions

View file

@ -126,7 +126,7 @@ void ViewImplementation::run_javascript(StringView js_source)
#if !defined(AK_OS_SERENITY)
ErrorOr<NonnullRefPtr<WebView::WebContentClient>> ViewImplementation::launch_web_content_process(ReadonlySpan<String> candidate_web_content_paths, StringView webdriver_content_ipc_path)
ErrorOr<NonnullRefPtr<WebView::WebContentClient>> ViewImplementation::launch_web_content_process(ReadonlySpan<String> candidate_web_content_paths)
{
int socket_fds[2] {};
TRY(Core::System::socketpair(AF_LOCAL, SOCK_STREAM, 0, socket_fds));
@ -149,17 +149,12 @@ ErrorOr<NonnullRefPtr<WebView::WebContentClient>> ViewImplementation::launch_web
auto webcontent_fd_passing_socket_string = TRY(String::number(wc_fd_passing_fd));
Vector<StringView> arguments {
auto arguments = Array {
"WebContent"sv,
"--webcontent-fd-passing-socket"sv,
webcontent_fd_passing_socket_string
};
if (!webdriver_content_ipc_path.is_empty()) {
TRY(arguments.try_append("--webdriver-content-path"sv));
TRY(arguments.try_append(webdriver_content_ipc_path));
}
ErrorOr<void> result;
for (auto const& path : candidate_web_content_paths) {
result = Core::System::exec(path, arguments, Core::System::SearchInPath::Yes);