mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-04 07:36:50 +00:00
We currently spin the event loop to wait for the specified element to become available. As we've seen with other endpoints, this can result in dead locks if another web component also spins the event loop. This patch makes the locator implementations asynchronous.
60 lines
1.4 KiB
C++
60 lines
1.4 KiB
C++
/*
|
|
* Copyright (c) 2022-2024, Tim Flynn <trflynn89@ladybird.org>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#include <WebDriver/Client.h>
|
|
#include <WebDriver/WebContentConnection.h>
|
|
|
|
namespace WebDriver {
|
|
|
|
WebContentConnection::WebContentConnection(IPC::Transport transport)
|
|
: IPC::ConnectionFromClient<WebDriverClientEndpoint, WebDriverServerEndpoint>(*this, move(transport), 1)
|
|
{
|
|
}
|
|
|
|
void WebContentConnection::die()
|
|
{
|
|
if (on_close)
|
|
on_close();
|
|
}
|
|
|
|
void WebContentConnection::navigation_complete(Web::WebDriver::Response const& response)
|
|
{
|
|
if (on_navigation_complete)
|
|
on_navigation_complete(response);
|
|
}
|
|
|
|
void WebContentConnection::window_rect_updated(Web::WebDriver::Response const& response)
|
|
{
|
|
if (on_window_rect_updated)
|
|
on_window_rect_updated(response);
|
|
}
|
|
|
|
void WebContentConnection::find_elements_complete(Web::WebDriver::Response const& response)
|
|
{
|
|
if (on_find_elements_complete)
|
|
on_find_elements_complete(response);
|
|
}
|
|
|
|
void WebContentConnection::script_executed(Web::WebDriver::Response const& response)
|
|
{
|
|
if (on_script_executed)
|
|
on_script_executed(response);
|
|
}
|
|
|
|
void WebContentConnection::actions_performed(Web::WebDriver::Response const& response)
|
|
{
|
|
if (on_actions_performed)
|
|
on_actions_performed(response);
|
|
}
|
|
|
|
void WebContentConnection::dialog_closed(Web::WebDriver::Response const& response)
|
|
{
|
|
if (on_dialog_closed)
|
|
on_dialog_closed(response);
|
|
}
|
|
|
|
}
|