mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-13 04:52:23 +00:00
WebContent+WebDriver: Make the element locator endpoints asynchronous
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.
This commit is contained in:
parent
80b3de8f9e
commit
ad9d623664
Notes:
github-actions[bot]
2024-10-31 00:43:33 +00:00
Author: https://github.com/trflynn89
Commit: ad9d623664
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2068
Reviewed-by: https://github.com/tcl3 ✅
8 changed files with 276 additions and 118 deletions
|
@ -237,6 +237,48 @@ Web::WebDriver::Response Session::fullscreen_window() const
|
|||
});
|
||||
}
|
||||
|
||||
Web::WebDriver::Response Session::find_element(JsonValue payload) const
|
||||
{
|
||||
return perform_async_action(web_content_connection().on_find_elements_complete, [&]() {
|
||||
return web_content_connection().find_element(move(payload));
|
||||
});
|
||||
}
|
||||
|
||||
Web::WebDriver::Response Session::find_elements(JsonValue payload) const
|
||||
{
|
||||
return perform_async_action(web_content_connection().on_find_elements_complete, [&]() {
|
||||
return web_content_connection().find_elements(move(payload));
|
||||
});
|
||||
}
|
||||
|
||||
Web::WebDriver::Response Session::find_element_from_element(String element_id, JsonValue payload) const
|
||||
{
|
||||
return perform_async_action(web_content_connection().on_find_elements_complete, [&]() {
|
||||
return web_content_connection().find_element_from_element(move(payload), move(element_id));
|
||||
});
|
||||
}
|
||||
|
||||
Web::WebDriver::Response Session::find_elements_from_element(String element_id, JsonValue payload) const
|
||||
{
|
||||
return perform_async_action(web_content_connection().on_find_elements_complete, [&]() {
|
||||
return web_content_connection().find_elements_from_element(move(payload), move(element_id));
|
||||
});
|
||||
}
|
||||
|
||||
Web::WebDriver::Response Session::find_element_from_shadow_root(String shadow_id, JsonValue payload) const
|
||||
{
|
||||
return perform_async_action(web_content_connection().on_find_elements_complete, [&]() {
|
||||
return web_content_connection().find_element_from_shadow_root(move(payload), move(shadow_id));
|
||||
});
|
||||
}
|
||||
|
||||
Web::WebDriver::Response Session::find_elements_from_shadow_root(String shadow_id, JsonValue payload) const
|
||||
{
|
||||
return perform_async_action(web_content_connection().on_find_elements_complete, [&]() {
|
||||
return web_content_connection().find_elements_from_shadow_root(move(payload), move(shadow_id));
|
||||
});
|
||||
}
|
||||
|
||||
Web::WebDriver::Response Session::execute_script(JsonValue payload, ScriptMode mode) const
|
||||
{
|
||||
return perform_async_action(web_content_connection().on_script_executed, [&]() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue