WebContent: Return the handle of the newly opened window from New Window

We were returning the handle of the already opened window, rather than
the handle of the window we just opened.
This commit is contained in:
Timothy Flynn 2024-10-20 08:51:21 -04:00 committed by Tim Ledbetter
commit 6cba55893e
Notes: github-actions[bot] 2024-10-20 15:42:09 +00:00

View file

@ -487,13 +487,12 @@ Messages::WebDriverClient::NewWindowResponse WebDriverConnection::new_window(Jso
// context is presented to the user are implementation defined.
auto* active_window = current_browsing_context().active_window();
VERIFY(active_window);
{
Web::HTML::TemporaryExecutionContext execution_context { active_window->document()->relevant_settings_object() };
MUST(active_window->window_open_steps("about:blank"sv, ""sv, "noopener"sv));
}
auto [target_navigable, no_opener, window_type] = MUST(active_window->window_open_steps_internal("about:blank"sv, ""sv, "noopener"sv));
// 6. Let handle be the associated window handle of the newly created window.
auto handle = current_browsing_context().top_level_traversable()->window_handle();
auto handle = target_navigable->traversable_navigable()->window_handle();
// 7. Let type be "tab" if the newly created window shares an OS-level window with the current browsing context, or "window" otherwise.
auto type = "tab"sv;