mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-29 08:11:13 +00:00
WebContent: Search all known navigables when WebDriver switches windows
We were only looking at the current top-level navigable and its children when searching for the specified window handle. We need to search *all* known navigables if the handle belongs to a window not in the current tree.
This commit is contained in:
parent
4ce05e5ccf
commit
47e9357243
Notes:
github-actions[bot]
2024-09-18 23:03:09 +00:00
Author: https://github.com/trflynn89 Commit: https://github.com/LadybirdBrowser/ladybird/commit/47e9357243c Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1434 Reviewed-by: https://github.com/tcl3 ✅
|
@ -449,16 +449,16 @@ Messages::WebDriverClient::SwitchToWindowResponse WebDriverConnection::switch_to
|
|||
// Otherwise, return error with error code no such window.
|
||||
bool found_matching_context = false;
|
||||
|
||||
if (auto browsing_context = current_top_level_browsing_context()) {
|
||||
browsing_context->for_each_in_inclusive_subtree([&](Web::HTML::BrowsingContext& context) {
|
||||
if (handle != context.top_level_traversable()->window_handle())
|
||||
return Web::TraversalDecision::Continue;
|
||||
for (auto* navigable : Web::HTML::all_navigables()) {
|
||||
auto traversable = navigable->top_level_traversable();
|
||||
if (!traversable || !traversable->active_browsing_context())
|
||||
continue;
|
||||
|
||||
m_current_browsing_context = context;
|
||||
if (handle == traversable->window_handle()) {
|
||||
m_current_browsing_context = traversable->active_browsing_context();
|
||||
found_matching_context = true;
|
||||
|
||||
return Web::TraversalDecision::Break;
|
||||
});
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!found_matching_context)
|
||||
|
|
Loading…
Reference in a new issue