From 6d331389ad8ce41ec029a1b3aa0e4766d3c0a463 Mon Sep 17 00:00:00 2001 From: Timothy Flynn Date: Fri, 18 Aug 2023 16:23:47 -0400 Subject: [PATCH] WebDriver: Coerce window handles to strings when activating a tab This allows the session to reject the request with "no such window", instead of crashing by assuming the JSON value was already a string. --- Userland/Services/WebDriver/Client.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Userland/Services/WebDriver/Client.cpp b/Userland/Services/WebDriver/Client.cpp index 56d91eb329..6d28c80875 100644 --- a/Userland/Services/WebDriver/Client.cpp +++ b/Userland/Services/WebDriver/Client.cpp @@ -323,7 +323,7 @@ Web::WebDriver::Response Client::switch_to_window(Web::WebDriver::Parameters par if (!handle.has_value()) return Web::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::InvalidArgument, "No property called 'handle' present"); - return session->switch_to_window(handle->as_string()); + return session->switch_to_window(handle->to_deprecated_string()); } // 11.4 Get Window Handles, https://w3c.github.io/webdriver/#dfn-get-window-handles