Files
ladybird/Userland/Services/WebDriver/WebContentConnection.cpp
Timothy Flynn 0722a3b1c0 LibWeb+WebContent+WebDriver: Asynchronously wait for dialog dismissal
There was a timing issue here where WebDriver would dismiss a dialog,
and then invoke another endpoint before the dialog was actually closed.
This is because the dismissal first has to hop over to the UI process to
close the graphical dialog, which then asynchronously informs WebContent
of the result. It's not until WebContent receives that result that the
dialog is considered closed, thus those subsequent endpoints would abort
due a dialog being "open".

We now wait for dialogs to be fully closed before returning from the
dismissal endpoints.
2024-10-26 11:25:42 +02:00

48 lines
1.1 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::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);
}
}