1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 20:47:45 +00:00

LibWeb: Make WebDriver check if the BC's navigable has been destroyed

The spec steps to check if a browsing context is open have been updated
for navigables.
This commit is contained in:
Timothy Flynn 2024-02-05 12:34:29 -05:00 committed by Andreas Kling
parent 623ad94582
commit 747fd86f26
4 changed files with 12 additions and 8 deletions

View file

@ -1833,8 +1833,8 @@ Messages::WebDriverClient::PrintPageResponse WebDriverConnection::print_page()
// https://w3c.github.io/webdriver/#dfn-no-longer-open
Messages::WebDriverClient::EnsureTopLevelBrowsingContextIsOpenResponse WebDriverConnection::ensure_top_level_browsing_context_is_open()
{
// A browsing context is said to be no longer open if it has been discarded.
if (m_page_client.page().top_level_browsing_context().has_been_discarded())
// A browsing context is said to be no longer open if its navigable has been destroyed.
if (m_page_client.page().top_level_browsing_context().has_navigable_been_destroyed())
return Web::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::NoSuchWindow, "Window not found"sv);
return JsonValue {};
}
@ -1901,7 +1901,7 @@ ErrorOr<void, Web::WebDriver::Error> WebDriverConnection::wait_for_navigation_to
return {};
// 2. If the current browsing context is no longer open, return success with data null.
if (m_page_client.page().top_level_browsing_context().has_been_discarded())
if (m_page_client.page().top_level_browsing_context().has_navigable_been_destroyed())
return {};
// FIXME: 3. Start a timer. If this algorithm has not completed before timer reaches the sessions session page load timeout in milliseconds, return an error with error code timeout.