mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-03 08:08:43 +00:00
WebContent+WebDriver: Update the current BC when switching windows
We had only implemented this step in the WebDriver process, but we need to update the remote WebContent process as well.
This commit is contained in:
parent
4a6d0e0f90
commit
5fc51b2ff9
Notes:
github-actions[bot]
2024-09-14 23:57:32 +00:00
Author: https://github.com/trflynn89
Commit: 5fc51b2ff9
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1403
Reviewed-by: https://github.com/tcl3 ✅
4 changed files with 23 additions and 4 deletions
|
@ -523,8 +523,27 @@ Messages::WebDriverClient::CloseWindowResponse WebDriverConnection::close_window
|
|||
}
|
||||
|
||||
// 11.3 Switch to Window, https://w3c.github.io/webdriver/#dfn-switch-to-window
|
||||
Messages::WebDriverClient::SwitchToWindowResponse WebDriverConnection::switch_to_window()
|
||||
Messages::WebDriverClient::SwitchToWindowResponse WebDriverConnection::switch_to_window(String const& handle)
|
||||
{
|
||||
// 4. If handle is equal to the associated window handle for some top-level browsing context in the
|
||||
// current session, let context be the that browsing context, and set the current top-level
|
||||
// browsing context with context.
|
||||
// Otherwise, return error with error code no such window.
|
||||
bool found_matching_context = false;
|
||||
|
||||
current_top_level_browsing_context()->for_each_in_inclusive_subtree([&](Web::HTML::BrowsingContext& context) {
|
||||
if (handle != context.top_level_traversable()->window_handle())
|
||||
return Web::TraversalDecision::Continue;
|
||||
|
||||
m_current_browsing_context = context;
|
||||
found_matching_context = true;
|
||||
|
||||
return Web::TraversalDecision::Break;
|
||||
});
|
||||
|
||||
if (!found_matching_context)
|
||||
return Web::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::NoSuchWindow, "Window not found");
|
||||
|
||||
// 5. Update any implementation-specific state that would result from the user selecting the current
|
||||
// browsing context for interaction, without altering OS-level focus.
|
||||
current_browsing_context().page().client().page_did_request_activate_tab();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue