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:
parent
31bb79295d
commit
3ba6b5a7cb
6 changed files with 21 additions and 18 deletions
|
@ -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
|
||||
|
|
|
@ -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 context’s active document’s 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()
|
||||
{
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue