mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-03 08:08:43 +00:00
LibWeb+WebContent+WebDriver: Implement the Perform Actions endpoint
Similar to script execution, this spins the WebDriver process until the action is complete (rather than spinning the WebContent process, which we've seen result in deadlocks).
This commit is contained in:
parent
8000837f78
commit
709deeb482
Notes:
github-actions[bot]
2024-10-01 09:03:18 +00:00
Author: https://github.com/trflynn89
Commit: 709deeb482
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1566
10 changed files with 83 additions and 16 deletions
|
@ -3,7 +3,7 @@
|
|||
* Copyright (c) 2022, Sam Atkins <atkinssj@serenityos.org>
|
||||
* Copyright (c) 2022, Tobias Christiansen <tobyase@serenityos.org>
|
||||
* Copyright (c) 2022, Linus Groh <linusg@serenityos.org>
|
||||
* Copyright (c) 2022, Tim Flynn <trflynn89@serenityos.org>
|
||||
* Copyright (c) 2022-2024, Tim Flynn <trflynn89@ladybird.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
@ -201,4 +201,22 @@ Web::WebDriver::Response Session::execute_script(JsonValue payload, ScriptMode m
|
|||
return response.release_value();
|
||||
}
|
||||
|
||||
Web::WebDriver::Response Session::perform_actions(JsonValue payload) const
|
||||
{
|
||||
ScopeGuard guard { [&]() { web_content_connection().on_actions_performed = nullptr; } };
|
||||
|
||||
Optional<Web::WebDriver::Response> response;
|
||||
web_content_connection().on_actions_performed = [&](auto result) {
|
||||
response = move(result);
|
||||
};
|
||||
|
||||
TRY(web_content_connection().perform_actions(move(payload)));
|
||||
|
||||
Core::EventLoop::current().spin_until([&]() {
|
||||
return response.has_value();
|
||||
});
|
||||
|
||||
return response.release_value();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue