WebContent+WebDriver: Asynchronously wait for navigations to complete

Similar to commit c2cf65adac, we should
avoid spinning the event loop from the WebContent-side of the WebDriver
connection. This can result in deadlocks if another component in LibWeb
also spins the event loop.

The AO to await navigations has two event loop spinners - waiting for
the navigation to complete and for the document to reach the target
readiness state. We now use NavigationObserver and DocumentObserver to
be notified when these conditions are met. And we use the same async IPC
mechanism as script execution to notify the WebDriver process when all
conditions are met (or timed out).
This commit is contained in:
Timothy Flynn 2024-10-25 10:28:29 -04:00 committed by Andreas Kling
commit bf0bc62654
Notes: github-actions[bot] 2024-10-26 09:26:47 +00:00
11 changed files with 157 additions and 53 deletions

View file

@ -389,6 +389,9 @@ void PageClient::page_did_request_media_context_menu(Web::CSSPixelPoint content_
void PageClient::page_did_request_alert(String const& message)
{
client().async_did_request_alert(m_id, message);
if (m_webdriver)
m_webdriver->page_did_open_dialog({});
}
void PageClient::alert_closed()
@ -399,6 +402,9 @@ void PageClient::alert_closed()
void PageClient::page_did_request_confirm(String const& message)
{
client().async_did_request_confirm(m_id, message);
if (m_webdriver)
m_webdriver->page_did_open_dialog({});
}
void PageClient::confirm_closed(bool accepted)
@ -409,6 +415,9 @@ void PageClient::confirm_closed(bool accepted)
void PageClient::page_did_request_prompt(String const& message, String const& default_)
{
client().async_did_request_prompt(m_id, message, default_);
if (m_webdriver)
m_webdriver->page_did_open_dialog({});
}
void PageClient::page_did_request_set_prompt_text(String const& text)