1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 04:07:46 +00:00

WebContent+WebDriver: Move the Get Current URL command to WebContent

This commit is contained in:
Timothy Flynn 2022-11-08 13:06:22 -05:00 committed by Tim Flynn
parent 31bb79295d
commit 3ba6b5a7cb
6 changed files with 21 additions and 18 deletions

View file

@ -491,8 +491,7 @@ Web::WebDriver::Response Client::handle_get_current_url(Vector<StringView> const
{
dbgln_if(WEBDRIVER_DEBUG, "Handling GET /session/<session_id>/url");
auto* session = TRY(find_session_with_id(parameters[0]));
auto result = TRY(session->get_current_url());
return make_json_value(result);
return session->web_content_connection().get_current_url();
}
// 10.3 Back, https://w3c.github.io/webdriver/#dfn-back

View file

@ -165,21 +165,6 @@ Web::WebDriver::Response Session::set_timeouts(JsonValue const& payload)
return JsonValue {};
}
// 10.2 Get Current URL, https://w3c.github.io/webdriver/#dfn-get-current-url
Web::WebDriver::Response Session::get_current_url()
{
// 1. If the current top-level browsing context is no longer open, return error with error code no such window.
TRY(check_for_open_top_level_browsing_context_or_return_error());
// FIXME: 2. Handle any user prompts and return its value if it is an error.
// 3. Let url be the serialization of the current top-level browsing contexts active documents document URL.
auto url = m_browser_connection->get_url().to_string();
// 4. Return success with data url.
return JsonValue(url);
}
// 10.3 Back, https://w3c.github.io/webdriver/#dfn-back
Web::WebDriver::Response Session::back()
{

View file

@ -51,7 +51,6 @@ public:
ErrorOr<void> stop();
JsonObject get_timeouts();
Web::WebDriver::Response set_timeouts(JsonValue const& payload);
Web::WebDriver::Response get_current_url();
Web::WebDriver::Response back();
Web::WebDriver::Response forward();
Web::WebDriver::Response refresh();