From 8070b258788174567b1acc4f88d61b7af163ab60 Mon Sep 17 00:00:00 2001 From: Noah Bright Date: Sat, 21 Sep 2024 10:41:00 -0400 Subject: [PATCH] WebDriver: Implement Switch To Frame for null ID Fill in a few lines from the spec :^) --- Userland/Services/WebContent/WebDriverConnection.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/Userland/Services/WebContent/WebDriverConnection.cpp b/Userland/Services/WebContent/WebDriverConnection.cpp index ec73973ccda8..0ddf28584643 100644 --- a/Userland/Services/WebContent/WebDriverConnection.cpp +++ b/Userland/Services/WebContent/WebDriverConnection.cpp @@ -526,10 +526,14 @@ Messages::WebDriverClient::SwitchToFrameResponse WebDriverConnection::switch_to_ // -> id is null if (id.is_null()) { - // FIXME: 1. If session's current top-level browsing context is no longer open, return error with error code no such window. - // FIXME: 2. Try to handle any user prompts with session. - // FIXME: 3. Set the current browsing context with session and session's current top-level browsing context. - dbgln("FIXME: WebDriverConnection::switch_to_frame(id=null)"); + // 1. If session's current top-level browsing context is no longer open, return error with error code no such window. + TRY(ensure_current_top_level_browsing_context_is_open()); + + // 2. Try to handle any user prompts with session. + TRY(handle_any_user_prompts()); + + // 3. Set the current browsing context with session and session's current top-level browsing context. + m_current_browsing_context = current_top_level_browsing_context(); } // -> id is a Number object